- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2019 12:59 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2019 01:51 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2019 10:36 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2019 01:51 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2021 01:04 AM
Hi Ankur
Does this work in Paris?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2021 01:24 AM
Any issue you are facing using this?
It should work as expected.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader