Query via glide record behaving unexpectedly in mail_script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2022 06:01 AM
Hi everyone, I had posted this as a reply to a different thread I posted but I figured since this is a different question than I originally asked in that thread I'd ask it as a new one.
I have a requirement of sending out a notification to the requested for of a catalog item if and then the 7 BD timer for each approval gets breached. We are trying to stay away from using business rules. So I thought I had finally figured out the mail_script and that it was working and then I got to test three and it captured the approval that was not approved but the previous two tests it was capturing was the last approval that had been approved. Below is the mail script I am using. Any thoughts or ideas on why the script is behaving unexpectedly and going between capturing the last approved approval and the last triggered approval?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2022 06:12 AM
The simplest way to filter out any approvals that had been approved would be to specify that you only want approvals that are still in the Requested state, or approvals that are not in the Approved state. For example:
// Add this line below gr.addQuery('sysapproval', current.sys_id);
gr.addQuery('state', 'requested');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2022 08:14 AM
Hi Dan,
Thanks for your reply, so the issue I run into going down that path is that the approval state are getting change to canceled even if they have been approved once the workflow closes out as closed complete. I did just think of that I can add a timer of 30 seconds or 1 minute either right after the notification activity or the run script that we use to close out our RITMs gets triggered. Please see the screenshots below showing that the approvals get changed to cancelled even if they were approved.