How to set field value same as another field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2023 10:59 PM
Hello Experts,
In incident form there is 2 fields called status(state) and Incident state(incident_state).
My requirement is
If state is selected with example work in progress how to set same value in incident state field.
Tested with business rule (before insert and update)
Filter condition is status changes
Set field values is Incident state same as state.
But it is not working because choices backend values is different in Incident state field.
Status :
New (1)
Assigned(8)
Work in progress (6)
Pending(-5)
Resolved(7)
Cancelled(10)
Incident state:
New (1)
Assigned(4)
Work in progress (7)
Pending(-2)
Resolved(5)
Cancelled(-6)
How to achieve this by using business rule script.
Thanks in advance.
Best regards,
Raj.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2023 11:02 PM
Hi there,
Out-of-the-box, there is already a business rule which covers this. Why are you deviating from this?
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
07-16-2023 11:10 PM
Hello @Mark Roethof
Thanks for your response.
1 year ago as per requirement they have changed the choices. (Choices mentioned above).Out of the box business rule is not working because incident state is having different choice backend values.
Best regards,
Raj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2023 11:39 PM - edited 07-16-2023 11:40 PM
Oke, then update the out-of-the-box business rule, or deactivate it and create a new one with same order.
Script could be something like below. Just really quickly drafted this in 30 seconds, so untested, etc..
var incident_state = '1'; // New
switch(current.getValue('state')) {
case '8': // Assigned
incident_state = '4';
break;
case '6': // Work in progress
incident_state = '7';
break;
case '...': // Etc
incident_state = '...';
break;
}
current.incident_state = incident_state;
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
07-16-2023 11:02 PM
Business Rule:
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field