Approvals action in requested item activity stream
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2018 01:41 AM
Hi
For us it is important when you look at the activity stream for requested item from the service portal, that you can see all approval actions from before incl. comments (some requested items can have 10 approvals in a workflow) .
i tried to make a businessrule on sysapproval_approver table, before update, but have not found a solution that work yet.
I know my approval comments and state will be write to sysapproval_approver table, but i dont know how to write the info to the requested item, so it visible from the servieportal
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2018 03:43 AM
My businessrule look like this, the only problem is my comment variable is empty, because the sys_journal_field is not created in that time my business rule run.
So i only have the info who approve and reject, but nut the comment. Any suggestion?
(function executeRule(current, previous) {
var comment = "";
var journal = new GlideRecord('sys_journal_field');
journal.addQuery('element_id', current.sys_id);
journal.addQuery('element', 'comments');
journal.addQuery('name', 'sysapproval_approver');
journal.query();
if (journal.next()) {
comment = journal.value;
gs.addInfoMessage(comment);
}
var gr = current.sysapproval.getRefRecord();
if(gs.getUserID() == current.approver)
gr.comments = current.state.getDisplayValue() + " by " + current.approver.getDisplayValue() + " comments: " + comment;
else
gr.comments = current.state.getDisplayValue() + " by " + gs.getUserDisplayName()+" on behalf of " + current.approver.getDisplayValue();
gr.update();
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2018 03:55 AM
When i tried in my instance , whenever i update the additional comments of approving record (for eg:chg), its reflecting in the approval record widget. I would suggest you write an after update BR on approval table and get last comment using "current.comments.getJournalEntry(1)" and update the approving record's additional comments.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2018 04:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2021 10:24 PM
Hello,
I'm having trouble getting Activity Stream to work. Could you please help? Thank you