- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2022 02:22 AM
Hello Team,
I have two fields "state" & "status" on a form. the value in state field should reflect in the other field .I want to sync /align both the fields .
If I write a business rule/client script on "state" field , it should work on the "status" field as well & vice versa.
Kindly help me on this.
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2022 02:33 AM
Hi,
then you need to use before update BR
Condition: State Changes OR Status Changes
Script:
// sync the fields using if else
if(current.state.changes()){
// sync state to status
if(current.state == '1')
current.status = '4';
else if(current.state == '5')
current.status = '6';
}
else if(current.status.changes()){
// sync status to state
if(current.status == '4')
current.state = '1';
else if(current.status == '6')
current.state = '5';
}
Regards
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
‎01-21-2022 02:33 AM
Hi,
then you need to use before update BR
Condition: State Changes OR Status Changes
Script:
// sync the fields using if else
if(current.state.changes()){
// sync state to status
if(current.state == '1')
current.status = '4';
else if(current.state == '5')
current.status = '6';
}
else if(current.status.changes()){
// sync status to state
if(current.status == '4')
current.state = '1';
else if(current.status == '6')
current.state = '5';
}
Regards
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
‎01-21-2022 06:27 AM
Hi Ankur,
It worked, Thank you so much for your help!!
Regards,
Pravallika