jbpm6 the actors of user task - actor

I make new jBPM Process with "a more advanced process including human tasks and persistence". Then run the process ,everything is fine. But if I change the actor of user task,for example, I change “mary” to “may” on Task 2
,a error will happen,the list’s size is 0.
// let john execute Task 1
List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
TaskSummary task = list.get(0);
System.out.println("John is executing task " + task.getName());
taskService.start(task.getId(), "john");
taskService.complete(task.getId(), "john", null);
assertNodeTriggered(processInstance.getId(), "Task 2");
// let mary execute Task 2
list = taskService.getTasksAssignedAsPotentialOwner("may", "en-UK");
System.out.println("list.size:"+list.size());
task = list.get(0);
System.out.println("May is executing task " + task.getName());
taskService.start(task.getId(), "may");
taskService.complete(task.getId(), "may", null);
then a error will happen,the console shows that the list's size is 0.
Can anyone help me?

Cause this are the users in userinfo.properties
https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core/src/test/resources/userinfo.properties

That's the expected behaviour.. if your processes create tasks for Mary but you query the tasks for May, it will return 0 tasks for May. Then the rest of the lines will fail.

Did you add the new user 'may' to UserGroupCallback?

Related

c# Create Windows Scheduled task for Any logged on user

c# Create Windows Scheduled task for Any logged on user (Built-In\Users) or "S-1-5-32-545"
I have a manually created scheduled task that works well. I would like to replicate the scheduled task when my solution is installed. It must run for any user that logs in and not run at a SYSTEM level. I have tried multiple versions of the items below with no luck.
// Create a new task definition and assign properties
TaskDefinition taskDefinition = taskService.NewTask();
taskDefinition.Settings.MultipleInstances = TaskInstancesPolicy.IgnoreNew;
taskDefinition.RegistrationInfo.Description = "Ensures the Agent is running";
taskDefinition.RegistrationInfo.Documentation = "Documentation at website";
taskDefinition.Principal.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
//taskDefinition.Principal.GroupId = "S-1-5-32-545";
//taskDefinition.Principal.RunLevel = TaskRunLevel.Highest;
//taskDefinition.Principal.GroupId = "Users";
//taskDefinition.Principal.LogonType = TaskLogonType.InteractiveToken;
[1]: [Scheduled Task]https://i.stack.imgur.com/uuGmn.png

Task scheduler history - get commands and arguments executed for each task already launched - using Powershell

Anyone would know if it is possible to get from the history task schedules, the command and arguments executed of all the tasks ?
I have a .ps1 script that obtains from the task scheduler history, three values: data of execution, taskname and result code.
$EventFilter = #{
LogName = 'Microsoft-Windows-TaskScheduler/Operational'
Id = 201 #action completed
StartTime = [datetime]::Now.AddDays(-10)
}
# PropertySelector for the Correlation id (the InstanceId) and task name
[string[]]$PropertyQueries = #(
'Event/EventData/Data[#Name="InstanceId"]'
'Event/EventData/Data[#Name="TaskName"]'
'Event/EventData/Data[#Name="ResultCode"]'
)
$PropertySelector = New-Object System.Diagnostics.Eventing.Reader.EventLogPropertySelector #(,$PropertyQueries)
# Loop through the start events
$TaskInvocations = foreach($StartEvent in Get-WinEvent -FilterHashtable $EventFilter){
# Grab the InstanceId and Task Name from the start event
$InstanceId,$TaskName,$ResultCode = $StartEvent.GetPropertyValues($PropertySelector)
# Create custom object with the name and start event, query end event by InstanceId
[pscustomobject]#{
TaskName = $TaskName
StartTime = $StartEvent.TimeCreated
ResultCode= $ResultCode
}
}
$TaskInvocations
Now I need to know what was the command and arguments executed in each task...
I don't find anything... :-( I'm beggining to think that this is not possible...
any idea, please?
Thanks in advance.

Changing A Tasks Title, or Date doesn't change the Tasks modified time - Google Tasks API

I am trying to troubleshoot why I cannot get changes to Task titles, and dates, from google tasks, based on the query param updatedMin:
In the following scenarios, all Changes made to tasks are done in Google Tasks flyout via calendar.google.com or done via the Android Tasks app.
Fail Scenarios
Fail Scenario 1:
I have a Task A in google Tasks with the Title of "foo"
I have a datetime called lastSync = 2022-04-04T04:24:02.773Z
I then change a Task A's title to "bar" at 2022-04-04T04:25:12.773Z - minute and 10 seconds greater than lastSync
I then do the following query:
import { google, tasks_v1 } from "googleapis";
const taskClient = google.tasks({ version: "v1", auth: oauth2Client });
if (list.updated) {
const updated = GoogleTaskClient.dateFromRfc339(list.updated);
if (updated > lastSync) {
const res = await taskClient.tasks.list({
tasklist: list.id,
updatedMin: formatRFC3339(lastSync),
showHidden: true,
showDeleted: true,
showCompleted: true,
maxResults: 100,
});
}
and the response has Zero items.
Fail Scenario 2:
I have a Task A in google Tasks with the Title of "foo"
I have a datetime called lastSync = 2022-04-04T04:24:02.773Z
I then change Task A's date at 2022-04-04T04:25:12.773Z - minute and 10 seconds greater than lastSync
run the query
and the response has Zero items.
Success scenarios
Success Scenario 1:
I have a Task A in google Tasks with the Title of "foo"
I have a datetime called lastSync = 2022-04-04T04:24:02.773Z
I then mark Task A as complete at 2022-04-04T04:25:12.773Z - minute and 10 seconds greater than lastSync
run the query
and the response includes Task A.
Success Scenario 2:
I have a Task A in google Tasks with the Title of "foo"
I have a datetime called lastSync = 2022-04-04T04:24:02.773Z
I then change a Task A's title to "bar" at 2022-04-04T04:25:12.773Z - minute and 10 seconds greater than lastSync
I then change Task A's date at 2022-04-04T04:25:15.773Z
run the query
and the response has Task A with the changes.
Summary
Changing the status of a Task always results in it being returned by the query, but changes to Date and Title don't appear to work with updatedMin.
Is this a known limitation of the task API - if so can you help me with some references.
I realized my error/ didn't mention this part 🤦‍♂️...
I was only getting tasks from TaskLists that were updated after the lastSync:
const taskClient = google.tasks({ version: "v1", auth: oauth2Client });
if (list.updated) {
const updated = GoogleTaskClient.dateFromRfc339(list.updated);
if (updated > lastSync) {
const res = await taskClient.tasks.list({
tasklist: list.id,
updatedMin: formatRFC3339(lastSync),
showHidden: true,
showDeleted: true,
showCompleted: true,
maxResults: 100,
});
}
The TaskList object from the API has an updated prop - string: Last modification time of the task list (as a RFC 3339 timestamp).
My error comes from thinking that changing the title of a Task or its time would result in a change to the updated prop of the parent List, but only changing the status of a task, or deleting a task does that or so it appears (I think it changes when order changes as well). Changes to Title, Description, Time, only cause the respective Task's update prop to be updated.
The docs could clarify that what qualifies as a update to a TaskList: https://developers.google.com/tasks/reference/rest/v1/tasklists#TaskList

OneTime ScheduleType -Windows Task Scheduler through Power shell

I am creating task scheduler through PowerShell deployment, I want to create One Time Task, I am using below script -
xScheduledTask SetupEmployeeProject
{
TaskName = "Mobile Employee Pay"
ActionExecutable = "$($Node.TargetRootFolder)\xxx\bin\Release\xxx.exe"
ActionArguments = "employee"
ScheduleType = "Once"
RepeatInterval = 1
StartTime ="7:00 PM"
Ensure = "Present"
#ExecuteAsCredential = $serviceCreds
}
But when my deployment is done, I am seeing an error
Failed to execute the powershell script.
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: At least one of the values 'Once' is not supported or valid for property 'ScheduleType' on class 'xScheduledTask'. Please specify only supported values:
What should be the ScheduleType for one time job??

sqlcmd runs fine and cmd line but will not produce output as a exec cmd step in a SQL Agent job

I am pulling my hair out and have tried every posting suggest.
I have a tsql script called C:\DBAReports\testsql.sql. If I go to a command logged prompt on my server, and run: sqlcmd -S localhost -i C:\DBAReports\testsql.sql -o C:\DBAReports\testout.txt
But if I create an new agent job with 1 step of type Operating system (CmdExec) to run as a SQL Server Agent Service Account, On Success Quit the job reporting success and on Failure Quit the job reporting failure. with the owner my same admin windows login as when I run the cmd prompt, right click on the agent job and start at step 1, I get the job succeeded (Job was invoked by my windows login), and the Step 1 is Executed as user is-sql "The step did not generate any output. Process Exit Code 0. The step was successful".
But it doesn't write the output file.
Any ideas?
The reason I want to do this is I am getting periodic Error: 18057, Severity: 20, State: 2 Failed to set up execution content in my sql server log. What I hope to do is kick off this job when this occurs to try and find out what are the SPIDs, status, SQL running, etc and write it to an output file.
My testsql.sql script contains.
SELECT
SPID = er.session_id
,STATUS = ses.STATUS
,[Login] = ses.login_name
,Host = ses.host_name
,BlkBy = er.blocking_session_id
,DBName = DB_Name(er.database_id)
,CommandType = er.command
,SQLStatement = st.text
,ObjectName = OBJECT_NAME(st.objectid)
,ElapsedMS = er.total_elapsed_time
,CPUTime = er.cpu_time
,IOReads = er.logical_reads + er.reads
,IOWrites = er.writes
,LastWaitType = er.last_wait_type
,StartTime = er.start_time
,Protocol = con.net_transport
,ConnectionWrites = con.num_writes
,ConnectionReads = con.num_reads
,ClientAddress = con.client_net_address
,Authentication = con.auth_scheme
FROM sys.dm_exec_requests er
OUTER APPLY sys.dm_exec_sql_text(er.sql_handle) st
LEFT JOIN sys.dm_exec_sessions ses
ON ses.session_id = er.session_id
LEFT JOIN sys.dm_exec_connections con
ON con.session_id = ses.session_id
Thanks in advance for any help. I have tried so many suggestions, and either get syntax errors on the command, and when I don't get any syntax error on the sqlcmd, it just generates no output.
An alternate way - try modifying the job step as Type: T-SQL script and the command as:
EXEC master..xp_CMDShell 'C:\Work\temp\test3.bat'
Please replace the bat file path with yours.

Resources