- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 01:48 PM
When the P1 INC work notes/ comments are not updated every 1 hour, email should be sent to the manager of Assigned to user. Can someone help me to achieve this.
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 09:50 PM
Hi @saipragna ,
You can achieve this using a Flow. Create a flow which will be attached to the P1 incidents and wait for an hour and check if there is an update in work notes/comments or not in last 1 hour and trigger an email to the manager if there is no update. You can try this approach,
1. Create a Flow Action which returns the difference between input time and current time, like the one below.
Use the below script in script step of the action.
(function execute(inputs, outputs) {
var current_time = new GlideDateTime();
var diffSeconds = gs.dateDiff(inputs.last_updated, current_time, true);
diffMins = diffSeconds/60;
diffMins = Math.round(diffMins);
outputs.diff = diffMins;
})(inputs, outputs);
2. Create a flow which will check for the last update on comments/worknotes every 10 minutes and triggers an email to assigned to manager if there is no update in last 1 hour.
2-A. Look up for last comments/worknotes in sys_journal_field table.
2-B: Check if a valid record is returned.
2-C: If a valid record is found, get the time difference between now and last comment updated time.
2-D: Check if the time difference is more than 1 hour
2-E: If the update is more than 1 hour, send an email to assigned to user manager.
2-F: Wait for 10 minutes before next iteration.
2-G: If the incident is resolved, get out of the loop and end the flow.
Please let me know, if you face any difficulties using this.
Thanks,
Anvesh
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2023 09:50 PM
Hi @saipragna ,
You can achieve this using a Flow. Create a flow which will be attached to the P1 incidents and wait for an hour and check if there is an update in work notes/comments or not in last 1 hour and trigger an email to the manager if there is no update. You can try this approach,
1. Create a Flow Action which returns the difference between input time and current time, like the one below.
Use the below script in script step of the action.
(function execute(inputs, outputs) {
var current_time = new GlideDateTime();
var diffSeconds = gs.dateDiff(inputs.last_updated, current_time, true);
diffMins = diffSeconds/60;
diffMins = Math.round(diffMins);
outputs.diff = diffMins;
})(inputs, outputs);
2. Create a flow which will check for the last update on comments/worknotes every 10 minutes and triggers an email to assigned to manager if there is no update in last 1 hour.
2-A. Look up for last comments/worknotes in sys_journal_field table.
2-B: Check if a valid record is returned.
2-C: If a valid record is found, get the time difference between now and last comment updated time.
2-D: Check if the time difference is more than 1 hour
2-E: If the update is more than 1 hour, send an email to assigned to user manager.
2-F: Wait for 10 minutes before next iteration.
2-G: If the incident is resolved, get out of the loop and end the flow.
Please let me know, if you face any difficulties using this.
Thanks,
Anvesh
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 12:21 PM
Hi Anvesh,
I'm having an error while I'm saving the flow action.
Not sure why this error is popping while I'm saving the flow. Can you please help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 07:11 PM
Hi @saipragna ,
You have prefixed the output assignment with minutes, is intended? If it is not intended please remove that.
If it doesn't solve your problem, please send the screenshots of all steps in the action.
Note: FYI, I took the "diff" output variables in both Script Step and Outputs step is Integer.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 09:24 PM
Hi Anvesh,
Yes, you're correct. I did a mistake. It is working as expected. Thank you so much.