- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2024 09:07 AM
Hi,
I have a flow. when a case record approval is rejected the case is getting closed and the rejection comment from approval is added to case. but in comment the name and timestamp also showing. i want to show only the comment how to achive?
i tried a business rule .. but it is showing empty.
how to do inside flow or by business rule.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("document_id", current.sys_id);
gr.addQuery("state","rejected");
gr.query();
var comm;
while(gr.next()){
gs.addInfoMessage(gr.comments);
comm =gr.getValue("comments");
}
current.comments = "The request has been updated by the approval team. Approval state: "+comm.getJournalEntry(1).split('\n')[1];
current.update();
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 01:18 AM
Hi @Rosy14 ,
Please try the below piece of code, which will remove both the time stamp and user detail.
current.comments.getJournalEntry(1).match(/\n.*/gm).join("\n");
Please mark the answer as correct/helpful based on impact.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 03:01 AM
Please share the whole code to debug further.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 03:16 AM
@Rosy14 , You have to return the string rather than the Journal. This will resolve it.
Mark this as Helpful / Accept the Solution if this helps.