UI Action - Condition "SARTWITH"

LucileC
Tera Expert

Hi All,

I'm trying to create an UI Action for the approvals table, but I have a problem with the condition.

I wanted that my "approve" button shows up when his number start by "PRI".

The current condition is : "current.state == 'requested'&&sysapprovalSTARTSWITHPRI&&sysapproval.state==30"

I saw in the system log that the system didnt recognize the "STARTWITH" :

org.mozilla.javascript.EcmaError: "sysapprovalSTARTSWITHPRI" is not defined.
   Caused by error in sys_ui_action.b825860bdb90001068de2a36ca96195e.condition at line 1

==>   1: current.state == 'requested'&&sysapprovalSTARTSWITHPRI&&sysapproval.state==30

Can you help me to create a condition that will works?

Thanks you

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

try something like this;

you need to put AND condition between those;

current.state == 'requested' && current.sysapproval.startsWith('PRI') && current.sysapproval.state == 30

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Starts with in a condition could already be something like:

current.sysapproval.startsWith("PRI")

Looking more at your condition, looks a bit of mix-up using string text in your condition.

Try something like:

current.state == 'requested' && current.sysapproval.startsWith('PRI') && current.sysapproval.state == 30

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

try something like this;

you need to put AND condition between those;

current.state == 'requested' && current.sysapproval.startsWith('PRI') && current.sysapproval.state == 30

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur

Does this work in Paris?

 

Any issue you are facing using this?

It should work as expected.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader