Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Rejection note in approval record.

Pandu8
Kilo Contributor

Hi Team,

 

Let's say A B C are three approvers for a particular requested item now for example A rejected his approval request,

IN B and C approval records rejection note needs to be populated in comments as "The Approval request has been rejected by A".

Let's say if A approvers his approval request then the same approval note needs to be populate in comments as "The approval request has been approved by A no action required".

Please respond how to achieve this requirement awaiting for your reply.Thank you in advance.

 

 

 

1 ACCEPTED SOLUTION

rahulpandey
Kilo Sage

Hi,

Instead of adding comments , you can define in activity :

Wait forA choice between different approval logics to determine which individual approvals result in approval of the activity's approval. Options are:
  • Anyone to approve: Any user can approve and the first approval causes the activity to complete with a result of approved.
  • Everyone to approve: All users must approve (see below for how a rejection is handled).
  • First response from anyone: The first approval or rejection from any user causes the activity to complete.
  • Condition based on script: Each time a user approves or rejects, the Approval script is called to determine if the activity should complete.
When anyone rejects
A choice between different approval logics to determine which individual rejections result in rejection of the activity's approval. Options are:
  • Reject the approval: Immediately complete the activity with a result of rejected.
  • Wait for other responses before deciding: Wait until we get other responses before making an approval or rejection decision. This allows users to change their mind until a decision is made.
Note: Note that if Wait for is set to Anyone to approvethen a single approval will cause the activity to complete with a result of approved even if one or more users reject.

However, if you do not want to follow above, then create a business rule (before on update) on approval table with below condition and script

condition = state changes to reject

var gr1 = new GlideRecord('sysapproval_approver');
gr1.addQuery('document_id', current.document_id);
gr1.addQuery('sys_id', '!=', current.sys_id);
gr1.query();
while(gr1.next()){
gr1.comments = "Approval Rejected by "+current.;
gr1.update();

 

Same can be done for approval approved

View solution in original post

5 REPLIES 5

Pandu8
Kilo Contributor

Hi Rahul,

 

Thank you for the help, script looks good and working fine.

what does the line"gr.addQuery('document_id', current.document_id);" in the below script. please extend your help by explaining that specific line in the script.