- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2023 09:13 AM
Run a flow - Reject all RITM approvals greater than 45 days old
1. Set approval status to Rejected
2. Set RITM state to Closed Incomplete
3. Run the flow on every Tuesday 7 AM CST.
4. Rejection Comment:
"This request was cancelled as the approver did not approve in the last 45 days."
Could anyone please suggest on it. Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2023 11:05 AM
After approval is rejected, your catalog workflow/flow should automatically cancel the RITM approval fields. Is it not happening? then it's advisable to check catalog workflows.
OR you can add another "update record" action in the new flow to update RITM record state.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2023 09:23 AM
Hi @GP001
Create a new flow and add schedule trigger onto the canvas with below configuration -
- Run on: Recurring
- Frequency: Weekly
- Day of week: Tuesday
- Time of day: 7:00 AM CST
Add a below scheduled script action -
var 45DaysAgo = new GlideDateTime().addDays(-45);
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('approval', 'LIKE', 'RITM%');
gr.addQuery('sysapproval', 'LIKE', 'Pending');
gr.addQuery('sys_updated_on', '<=', 45DaysAgo);
gr.query();
while (gr.next()) {
var ritm = new GlideRecord('sc_req_item');
ritm.get(gr.sysapproval.getRecord());
ritm.approval = 'Rejected';
ritm.state = 'Closed Incomplete';
ritm.work_notes = 'This request was cancelled as the approver did not approve in the last 45 days.';
ritm.update();
}
Thanks,
Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2023 09:26 AM
Hi Tushar,
I appreciated your update. But i need a flow designer on the above requirement instead of script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2023 09:37 AM
1. Create a new Flow with below trigger
2. Add an action "Lookup Records" with condition as in below Screenshot
3. Use Flow logic "For each"
4. For each item returned from above logic, you can add action "Update Record" to reject the approval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2023 10:46 AM
Hi Swapna,
Thanks a lot for your reply. Upto above is fine, but i need to update the associated RITM state is Closed incomplete and status is Rejected. Could you please update here. Thank you so much!