Compare future value in Due date(in Task A) with current Date time and if matches then create Task B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19m ago
I need to create Task B in a custom table (In custom app) when either of the following conditions are met:
STC_flag = Yes and Next Activity = Y, OR STC_flag = Yes and the Due Date/Time of Task A equals the current date/time.
Due date holds a future value, Code 1 is to capture that value.
Code1:
var gdt = new GlideDateTime();
return addBusinessDays(gdt,3);
function addBusinessDays(gdt, daysToAdd) {
var count = 0;
while (count < daysToAdd) {
gdt.addDaysLocalTime(1); // move forward one day
// 1 = Monday … 7 = Sunday
var dayOfWeek = gdt.getDayOfWeekLocalTime();
if (dayOfWeek != 6 && dayOfWeek != 7) {
// Not Saturday or Sunday → count it
count++;
}
}
return gdt;
I have created an Action in flow designer to capture current date and time, mention in Code 2:
