- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 10:03 AM
I know there are multiple threads on this but I have had no luck. For example add Website to whitelist. This RITM will go to 4 Security people where only one needs to approve. If they reject or simply add a comment we want that comment to copy to the Parent RITM. I have looked at many threads and all are not working for me.
Business rule
Table - Approval [sysapproval_approver]
When to run- Before / on Update / filter - I have it set to Comments changes.
My current Script- Not sure how close this is to working
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 12:18 PM
Hi @Tfnhodgi
you can write before business rule and use the below Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
// Get the parent RITM (Request Item)
var reqitem = new GlideRecord('sc_req_item');
reqitem.addQuery('sys_id', current.document_id);
reqitem.query();
if (reqitem.next()) {
reqitem.comments = reqitem.comments + "\n" + current.comments.getJournalEntry(-1);
reqitem.update();
}
})(current, previous);
It is working in my pdi
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 12:06 PM
Hi @Tfnhodgi ,
You'll need to get the approval's comment from the sys_journal_field table:
var journalGR = new GlideRecord('sys_journal_field');
journalGR.addQuery('element_id', current.getUniqueValue());
journalGR.addQuery('element', 'comments');
journalGR.query();
if(journalGR.next())
grRITM.comments = journalGR.value;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 01:04 PM
tried with no luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 12:18 PM
Hi @Tfnhodgi
you can write before business rule and use the below Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
// Get the parent RITM (Request Item)
var reqitem = new GlideRecord('sc_req_item');
reqitem.addQuery('sys_id', current.document_id);
reqitem.query();
if (reqitem.next()) {
reqitem.comments = reqitem.comments + "\n" + current.comments.getJournalEntry(-1);
reqitem.update();
}
})(current, previous);
It is working in my pdi
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 01:03 PM
Hi, this is not working. I add the comment (below screenshot) and I want it to go the Parent RITM but it is not. Is there anything else that can block this?