Condition to check if string starts with numbers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 09:17 AM
Hello,
I need some help with a condition. We have a notification on the sc_req_item record that needs to go out only if the requested_for.user_name starts with a number (0-9). What's the best way to construct the condition?
Thanks,
Maria

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 09:22 AM
Hi Maria,
Where is this notification triggered from? Are you using the Record Updated or Inserted method or are you triggering from an event?
If the former (shown here), you're out of luck.
If you are triggering from an event (likely form a business rule) then you can have the business rule do the checking before firing the event.
Email Notifications - ServiceNow Wiki
You can tell really quickly by looking at that "When to send" tab on the notification Let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 09:30 AM
Hi Chuck,
We are triggering the notification when record is inserted.
Will an advanced condition work?
Maria

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 09:34 AM
Are you talking about the advanced condition on the business rule or the notification? (screenshot please)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 12:40 PM
Hi,
First option , you can use the advance condition of notification and edit like below and it will send the notification.
var g1=current.getValue('your_field_name');
if(/^[0-9]/.test(g1)) // Regex
{
answer=true;
}
else
{
answer=false;
}
Second option, you can also use a BR to call an event and then using that event the notification will be triggered.
Thanks.
Hit Like/Helpful/Correct, if applicable.