I want to send Notification to manager If sctask status not changed for 1 business day
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 02:46 AM - edited 10-06-2023 03:08 AM
I want to send Notification to manager If sctask status not changed for 1 business day(excluding weekends)for a particular catalog item using flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 03:34 AM
HI @vasu17 ,
I trust you are doing great.
Create a Scheduled Flow:
- Navigate to Flow Designer.
- Click on New > Scheduled Flow.
- Name the flow, for example, "Notify Manager for Stagnant sctask".
2. Define the Schedule:
- Set the Run field to "Daily".
- Set the Time field to the desired time you want the flow to run, for example, "5:00 PM".
- Ensure Exclude Weekends is checked.
3. Add an Action:
- Click on Add Action.
- Search for and select the Lookup Records action from the Service Catalog scope.
- Set the table to sc_task.
- Add a condition to filter tasks based on the desired catalog item and where the sys_updated_on field is older than 1 business day. For example:
- Catalog Item is [Your Specific Catalog Item]
- sys_updated_on <= javascript:gs.businessDaysAgoStart(1)
4. Loop Through the Results:
- Add a For Each loop to iterate over the results from the previous action.
- For each record, retrieve the manager of the assigned user.
5. Send Notification:
- Inside the loop, add an action to send a notification.
- Use the Send Email action.
- Set the Recipient to the manager retrieved in the previous step.
- Fill in the Subject and Message fields as desired, ensuring they convey the necessary information in a professional tone.
6. Publish the Flow:
- Once you've set up the flow as described, click on Save.
- Then, click on Publish to activate the flow.
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 03:42 AM - edited 10-06-2023 03:42 AM
Hi @vasu17 ,
You can try the following flow, this flow sends an email to Assigned to User's manager if it was not updated in last 1 business day (not calendar day). For business days calculation I took "8-5 weekdays excluding holidays" schedule with sys_id 090eecae0a0a0b260077e1dfa71da828 from cmn_schedule table, you can change this if you want.
And here is the flow.
1. From flow designer create a new flow like this,
2. Set the trigger to run daily at 6 AM (You can change if you want)
3. Create a flow variable like the one below.
4. Find the Catalog Tasks using with the filter conditions you want.
5. Use for each in flow logic to iterate through each catalog task record you got in previous step.
6. Calculate the business duration using inline script and store it in the flow variable.
var updated_on = fd_data._2__for_each.item.sys_updated_on;
var dur = new DurationCalculator();
dur.setSchedule('090eecae0a0a0b260077e1dfa71da828');
dur.calcScheduleDuration(updated_on, new GlideDateTime());
var secs = dur.getSeconds();
var bdays = secs/(9 * 60 * 60)
return bdays;
7. Check if Business duration is more than one day
8. If yes, send the email to Assigned To manager, you can change it to Group manager if you want.
Please mark my answer helpful and accept as solution if it helped you 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 06:20 AM
Hi @AnveshKumar M
Thanks for your Response,
I am not able to select the option catalog task record , is there anything needs to be checked ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 07:18 AM
Hi @vasu17
You should use Look up records in Step 1, but you used Look up Record, then you should be able to select it.
Anvesh