Workflow changes for RITM approvers changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2024 07:26 AM
Hi,
I have an below business rule (after update) script and it's working as expected. The script will perform when user changes the assignment group on record it makes existing approvers as "No Longer Required" and added the new assignment group members as an approvers.
My issue is, when the time of script making the old approvers as "No longer Required" the workflow will be moving the "approval group" activity to next activity automatically . My requirement is approval group activity needs to be wait until the new users needs to be approved.
Please find the below workflow for your reference.
Business rule script:
(function executeRule(current, previous /*null when async*/) { // var newGroupSysId = current.u_approver.sys_id.toString(); var approvalGR = new GlideRecord('sysapproval_approver'); approvalGR.addQuery('sysapproval', current.sys_id); approvalGR.query(); while (approvalGR.next()) { approvalGR.state = 'not_required'; //approvalGR.deleteRecord(); approvalGR.update(); } var grMember = new GlideRecord('sys_user_grmember'); grMember.addQuery('group', newGroupSysId); grMember.query(); while (grMember.next()) { var approval = new GlideRecord('sysapproval_approver'); approval.initialize(); approval.state = 'requested'; approval.sysapproval = current.sys_id; approval.approver = grMember.user; approval.insert(); } })(current, previous); |
Thanks,
Rajesh Bandila
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2024 11:23 AM
Instead of using a business rule, add a "Run Script" activity at the appropriate place in your Workflow and execute your code from there.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/