I want to send Notification to manager If sctask status not changed for 1 business day

vasu17
Tera Contributor

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

5 REPLIES 5

Amit Gujarathi
Giga Sage
Giga Sage

HI @vasu17 ,
I trust you are doing great.

Create a Scheduled Flow:

  1. Navigate to Flow Designer.
  2. Click on New > Scheduled Flow.
  3. Name the flow, for example, "Notify Manager for Stagnant sctask".

2. Define the Schedule:

  1. Set the Run field to "Daily".
  2. Set the Time field to the desired time you want the flow to run, for example, "5:00 PM".
  3. Ensure Exclude Weekends is checked.

3. Add an Action:

  1. Click on Add Action.
  2. Search for and select the Lookup Records action from the Service Catalog scope.
  3. Set the table to sc_task.
  4. 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&colon;gs.businessDaysAgoStart(1)

4. Loop Through the Results:

  1. Add a For Each loop to iterate over the results from the previous action.
  2. For each record, retrieve the manager of the assigned user.

5. Send Notification:

  1. Inside the loop, add an action to send a notification.
  2. Use the Send Email action.
  3. Set the Recipient to the manager retrieved in the previous step.
  4. Fill in the Subject and Message fields as desired, ensuring they convey the necessary information in a professional tone.

6. Publish the Flow:

  1. Once you've set up the flow as described, click on Save.
  2. 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



AnveshKumar M
Tera Sage
Tera Sage

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,

AnveshKumarM_0-1696588312222.png

 

2. Set the trigger to run daily at 6 AM (You can change if you want)

 

AnveshKumarM_1-1696588333698.png

3. Create a flow variable like the one below.

 

AnveshKumarM_4-1696588499636.png

4. Find the Catalog Tasks using with the filter conditions you want.

 

AnveshKumarM_2-1696588444459.png

 

5. Use for each in flow logic to iterate through each catalog task record you got in previous step.

 

AnveshKumarM_3-1696588477349.png

 

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;

 

 

AnveshKumarM_5-1696588545257.png

7. Check if Business duration is more than one day

AnveshKumarM_6-1696588575496.png

8. If yes, send the email to Assigned To manager, you can change it to Group manager if you want.

 

AnveshKumarM_7-1696588601714.png

 

AnveshKumarM_8-1696588617076.png

 

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

 

 

 

Thanks,
Anvesh

vasu17
Tera Contributor

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 ?

vasu17_1-1696598275061.png

 

 

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.

Thanks,
Anvesh