- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 04:57 AM
Hello Everyone
I am trying to update a case record work notes with approver name who has approved / rejected a case.
When a case is rejected, rejection comments needs to added in the work notes of a case.
Could any one please help me to achieve it ? (please refer attached screenshot)
Thanks in advance
Nagurbi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 06:45 AM - edited 10-25-2024 06:46 AM
here is a sample, you can add more conditions and refine it as needed
(function executeRule(current, previous /*null when async*/) {
var grec = new GlideRecord("change_request");
grec.addQuery("sys_id", current.sysapproval);
grec.query();
if (grec.next()) {
grec.work_notes = 'Action by = '+current.approver.getDisplayValue() ;
grec.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 06:51 AM
Hi @Nagurbee1 ,
Please follow the steps below that I've completed for the change request table. You can replace the change request with the case table in the GlideRecord object.
Establish a business rule on the sysapproval_approver table that activates when the state changes to either approved or rejected.
In the script, we will use GlideRecord to ensure that the changes apply exclusively to the specified table and will update the work notes accordingly.
Output :
You can modify the business rule condition according to your needs; this is just an example of how to achieve your requirements.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you found my response **helpful**, I’d appreciate it if you could take a moment to select **"Accept as Solution"** and **"Helpful"** Your support not only benefits me but also enriches the community.
Thank you!
Moin Kazi
www.linkedin.com/in/moinuddinkazi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 04:59 AM
Hi,
You will need to write a BR that runs on Approval table (where Approval for is table in question only)
And then you can copy the state and comments etc to parent record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 06:38 AM
Hello Anurag
Thank you so much for your quick response.
If possible , could you please post the sample script ?
Thanks in advance
Nagurbi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 06:45 AM - edited 10-25-2024 06:46 AM
here is a sample, you can add more conditions and refine it as needed
(function executeRule(current, previous /*null when async*/) {
var grec = new GlideRecord("change_request");
grec.addQuery("sys_id", current.sysapproval);
grec.query();
if (grec.next()) {
grec.work_notes = 'Action by = '+current.approver.getDisplayValue() ;
grec.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 08:37 AM
Hello Anurag
Thank you so much, it has worked for me and I have accepted your solution.