- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 11:30 AM
Hi Developers,
I have a Requirement to trigger Approvals when the Re-schedule fields are changed/ modified. For that i wrote a before update/insert Business rule, that runs when the Re-schedule start or Reschedule end dates are modified/changed.
[P.s: I cant achieve this in Workflow as my Change workflow is a complex one and i have to check the reschedule dates are filled/not in each and every stage of change request lifecycle]
My business rule as follows:
var appgroup = current.u_reschedule_approval_group; ----(reschedule approver group is a field which has the Approval group)
var getapprovers=new GlideRecord('sys_user_grmember'); ---(Am checking who are the members of the respective Approval group in group member table)
getapprovers.addQuery('group',appgroup);
gs.log('approver grp', appgroup);
getapprovers.query();
while(getapprovers.next())
{
gs.log('approver name',getapprovers.toString());
var gr=new GlideRecord('sysapproval_approver');
gr.initialize();
gr.sysapproval = current.sys_id;
gr.approver = getapprovers.toString();
gr.state='requested';
gr.insert();
}
The script is inserting the Empty approvals in the Approval table.
Please find the attached screenshot for the same.
Kindly help me fixing this!
Any idea will be much Appreciated!
Thanks in Advance,
Keerthana
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 11:39 AM
change
gr.approver = getapprovers.toString();
to
gr.approver = getapprovers.user.sys_id.toString();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 11:39 AM
change
gr.approver = getapprovers.toString();
to
gr.approver = getapprovers.user.sys_id.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 12:13 PM
Hi Mike,
Thanks It works! and one more help..
As of now if my approval group has 4 members,its awaiting all of them to approve it instead of anyone to approve.
how to make the change approved even if anyone from the group approves?
Thanks in Advance,
Keerthana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2021 01:24 AM
Hi Keerthana,
I need to implement the same scenario as you have described. Were you able to achieve the solution for your last query - how to make the change approved even if anyone from the group approves?
Please share the solution if you have.
Thanks,
Vidya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2024 08:45 PM
Hi Vidyarani,
The "Flow designer" is the easiest way to achieve this scenario.