- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello community members! This may sound like a very simple question but I am new to ServiceNow development. How would I set up conditional logic for Incidents? Specifically, if the short description contains "Incident INC-1 opened" then assign it to a specific group. One of the challenges is the number will consistently increment by one every time a new Incident is created. Any help here is appreciated!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @sseverance
Here Best approach is to use a Before Business Rule in ServiceNow.
- Table: Incident
- Name: Assign Special Group by Pattern
- Advanced: Checked
- Insert: Checked
- Update: Checked
Trigger Condition:
Short description starts with "Incident INC-" AND
Short description end with "Opened"
(Better would be apply regex using condition builder //refer : https://www.youtube.com/watch?v=KDDrnKeU-JU)
then using script , set the assignment group value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hello @sseverance ,
1.Create a new Assignment Rule
Table: Incident
Condition:
Short description contains Incident INC-
OR
2.Business Rule
Table: Incident
When: Before
Insert: Checked
Script:
(function executeRule(current, previous) {
if (current.short_description &&
current.short_description.indexOf('Incident INC-') > -1) {
current.assignment_group = 'YOUR_GROUP_SYS_ID';
}
})(current, previous);
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You,
Sujit Jadhav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @sseverance
As @Sujit Jadhav have mentioned you can utilize assignment rule based on condition. Please remember, to have an assignment rule based on a string field is in general not good practice as string can change to have a space, an additional character or so fourth - so you solution will not be very resilient.
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @sseverance
Here Best approach is to use a Before Business Rule in ServiceNow.
- Table: Incident
- Name: Assign Special Group by Pattern
- Advanced: Checked
- Insert: Checked
- Update: Checked
Trigger Condition:
Short description starts with "Incident INC-" AND
Short description end with "Opened"
(Better would be apply regex using condition builder //refer : https://www.youtube.com/watch?v=KDDrnKeU-JU)
then using script , set the assignment group value.
