Why does todos_approval_actions save the comment tot the target record?

MarkWe
Tera Guru

While working on some issues with approval-comments, we noticed that when end-users approve / reject a request using ESC, the comments are directly saved to the target record.

This is different from when a request is approved / rejected from the platform UI, where the comment is saved in the sysapproval_approver-table.

I'm a bit confused as why there is a difference between these two methods.

 

What we observe

Action: End user rejects approval for a RITM (sc_req_item) using ESC via the todos_approval_actions widget
Result: The sysapproval_approver record is changed to state = rejected. The comment is added to the sc_req_item-record.

Action: User rejects approval using the platform UI on the same RITM (sc_req_item)
Result: The sysapproval_approver record is changed to state = rejected AND the comment is added to that record. A business rule than copies the comment to sc_req_item.

 

But why? Why is the comment by default added to the target record, and not to the sysapproval_approver table?
This seems to also complicate ACL's on every target table, as todos_approval_actions uses GlideRecordSecure to save the comment.

7 REPLIES 7

Loudigi
Kilo Sage

Same! I even opened a HI case for this. I had to develop some workaround for this, but the response from SN was that this is will be resolved in San Diego. We haven't upgraded yet so I cannot confirm. 

Can you provide the workaround for it? Did you have to create any ACLs for Approver users to provide access to write comments in Req Item table?

MarkWe
Tera Guru

So, we're on the San Diego release, but the issue is not resolved on that release. I even tried a fresh developer instance, but to no avail.

We ended up making two changes to the service portal widget "Todos Approval Actions".
These changes ensure that comments are written to sysapproval_approver, instead of the target record.

The changes as follows:

Under Server script in the function updateApprovalAndComment, we changed the following lines:

FROM:

commentGr.comments = gs.getMessage('Reason for rejection: {0}', request.comments);
commentGr.update();

TO:

approvalGr.comments = gs.getMessage('Reason for rejection: {0}', request.comments);

 

So we changed "commentGr" to "approvalGr" and removed the call to .update(), since the update is called later for approvalGr.

We made this change 2 times: for rejection and a few lines later for approval as well.

Works great!