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.

Approve UI Action condition not working

Kearney
Tera Contributor

Hi All,

I am trying to create a new approval UI Action for a specific user role (duplicating the existing sysapproval_approver Approve UI Action). I want to hide this new UI Action from the Change request table which I have got working using

 

RP.isRelatedList()&&parent.sys_class_name!='change_request'

 

However as soon as I add more it just shows all the time even on the change table Is there something wrong with my syntax?

 

RP.isRelatedList()&&parent.sys_class_name!='change_request' && current.state == 'requested' && (gs.hasRole('approval_admin') || isApprovalMine(current))

 

 

I have tried a few different ways however cant get this to work

Thanks

6 REPLIES 6

Amit Pandey
Kilo Sage

Hi @Kearney 

 

Please use the semicolon in end. I have configured one like this and is working-

 

!gs.hasRole('sn_customerservice.customer') && gs.hasRole('itil') && current.isValidRecord();

 

AmitPandey_0-1712657089563.png

 

Regards,

Amit

Thanks Amit,

Unfortunately, that didn't work It hides it from CHG approval records with RP.isRelatedList()&&parent.sys_class_name!='change_request' however adding anything after this breaks the condition where it shows all the time

I believe the problem is in isApprovalMine(current)). Can you remove it and check?

 

Hi Amit,

In the condition currently that is not in it As soon as I add anything EG && current.state=='requested' it decides to show and not hide it

FULL CONDITION

RP.isRelatedList()&&parent.sys_class_name!='change_request'&&current.state=='requested'