The CreatorCon Call for Content is officially open! Get started here.

Approvals action in requested item activity stream

kristianhaahrde
Mega Contributor

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 

find_real_file.png

 

5 REPLIES 5

kristianhaahrde
Mega Contributor

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);

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

kristianhaahrde
Mega Contributor

I found a solution by my self, maybie not the best one, men i give me the functionality i need, here it is:

find_real_file.png

 

find_real_file.png

 

find_real_file.png

Brian171
Tera Contributor

Hello,

I'm having trouble getting Activity Stream to work.  Could you please help?  Thank you