forked from moeenahmedsultan/msdynamics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorkflow Due Date Time Exceeded Error
33 lines (29 loc) · 1.15 KB
/
Workflow Due Date Time Exceeded Error
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
static void Moeen_WorkflowDueDateTimeErrorResolution(Args _args)
{
WorkflowWorkItemTable workflowWorkItemTable;
utcDateTime dateTimeToday, setDateTime;
date dateToday, setDate;
TimeOfDay timeToday, setTime;
int i = 0;
//Change date and time as per your requirement
//DueDateTime expired before today. We will use this to filter the query below.
dateToday = str2Date("1/23/2019",213);
timeToday = str2time("12:00 am");
dateTimeToday = DateTimeUtil::newDateTime(dateToday,timeToday);
//Change date and time as per your requirement
//Set the DueDateTime to future date & time
setDate = str2Date("2/10/2019",213);
setTime = str2time("12:00 pm");
setDateTime = DateTimeUtil::newDateTime(setDate,setTime);
//Updating the expired DueDateTime and updating it to the future.
ttsBegin;
while select forUpdate WorkflowWorkItemTable
where WorkflowWorkItemTable.DueDateTime < dateTimeToday
{
workflowWorkItemTable.DueDateTime = setDateTime;
workflowWorkItemTable.update();
i++;
}
ttsCommit;
info(strFmt("%1 record(s) updated", i));
}