Change Request rejected comments to mandatory

traviswarren
Kilo Expert

Hello all, Having a little issue with the UI Policy "Comments mandatory on rejection".   It appears that comments are not mandatory for Change Request's.

 

I made the update from blog post

https://www.servicenow.com/community/developer-blog/setting-approval-comments-to-mandatory-in-eureka...

 

This fixed the issue with Request Item tickets but not Change Request.

 

Overall, if the approval is for a Change Request the user is notified to enter comments if the State is Rejected but they can click save or update to bypass the mandatory field.

 

Any help is appreciated.  

 

Thanks.

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Travis,



That should work, I am not really sure why it is giving the odd behavior. However for a workaround you can write a Business rule to achieve this requirement.


Business rule:


When :Before


Insert: true , update : true


Filter condition: state is rejected


Condition field under advanced : current.comments.nil()


Script:


gs.addErrorMessage("Comments are required when rejecting an approval");


current.state = 'requested';


current.setAbortAction(true);


View solution in original post

2 REPLIES 2

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Travis,



That should work, I am not really sure why it is giving the odd behavior. However for a workaround you can write a Business rule to achieve this requirement.


Business rule:


When :Before


Insert: true , update : true


Filter condition: state is rejected


Condition field under advanced : current.comments.nil()


Script:


gs.addErrorMessage("Comments are required when rejecting an approval");


current.state = 'requested';


current.setAbortAction(true);


salemsap
Tera Expert

Hi Travis,


check is there any other script written with the condition like current.sys_class_name == 'change_request'.