- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 11:20 AM
Hi all,
I am trying to use Matches Regex Condition Builder for Assignment Rules. I get a match when I use https://regex101.com/ to build the expressions however the same expression doesn't seem to work in ServiceNow.
Use case:
Applies To - Table ==> Incident ; Conditions ==> Short Description matches regex /example/i
Assign To - Group ==> Assignment Group 1
So basically any incident which contains "example" in the short description irrespective of the case should assign to Assignment Group 1.
Thanks,
Swati
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 11:14 AM
@SwatiYeginati Here is another alternative for you if case insensitive contains doesn't work on Assignment rule.
Create a scripted Assignment rule as follows.
if(current.short_description.toLowerCase().indexOf('example')>-1){
current.assignment_group.setDisplayValue("Hardware"); //Replace with your Assignment group name
current.assigned_to.setDisplayValue('ITIL User'); //Replace with your assignee name
}
This assignment rule will run for all the variants of Example/example/EXample. I have tested this solution on my PDI and it works fine for different combinations.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 08:45 PM
Hi you dont need to use regex, you can use "contains" in conditions to achieve the same
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 10:35 AM
Hi Harish,
I would like to use regex because I want to ignore the case of all the letters in the string. When I use contains I will have to build a condition such as Short Description contains Example OR Short Description contains example OR Short Description contains eXample OR ...... so on which is very tedious.
Thanks,
Swati

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 11:14 AM
@SwatiYeginati Here is another alternative for you if case insensitive contains doesn't work on Assignment rule.
Create a scripted Assignment rule as follows.
if(current.short_description.toLowerCase().indexOf('example')>-1){
current.assignment_group.setDisplayValue("Hardware"); //Replace with your Assignment group name
current.assigned_to.setDisplayValue('ITIL User'); //Replace with your assignee name
}
This assignment rule will run for all the variants of Example/example/EXample. I have tested this solution on my PDI and it works fine for different combinations.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 02:43 PM
When I try to test the assignment rules something strange happens when the short description doesn't match the first assignment rule, 1) It throws an error "Record Not Found". 2) The following assignment rules don't work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 12:29 AM
I tested it on my instance for negative scenarios as well and it runs fine doesn't assign incident to the assignment_group or assignee if the description doesn't contain word example. Can you share some screenshot of the issue you are facing.