- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 01:12 PM
Hi,
I have an issue where if the Incident state is moved from 'New' straight to 'Resolved' then the SLA Definition is not attached to the Incident record. Ideally I need to force the user to move the Incident state from 'New' to 'In progress' before it is moved to 'Resolved'.
I believe I need to create a Client Script but I'm not sure on the script to validate if the Incident State value has moved to 'In progress' before it is moved to 'Resolve'.
Any help appreciated.
Thank you in advance!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2023 01:17 AM
This needs to be done on onchange client script with the state filed as the column
if (oldValue == newValue)
return;
if(oldValue == "2" && newValue =="6"){
//write your script
}
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 02:32 PM
Hi @Mark_10
You can do this using before update BR on your incident table.
Use the below logic and update it as per your needs if necessary.
Give the BR condition like when state changes
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (previous.state == "1" && current.state == "6") { //please map your state values it it's different
gs.addErrorMessage("You cannot change the state directly from New to Resolved");
current.setAbortAction(true);
}
//it will if the state is new and if the user is changing the state to resolved it will abort the action and throws the error message..
})(current, previous);
or if you want to go with no code follow the below images:
Hope it helps
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 11:45 PM
Hi @Murthy Ch ,
That works, however I noticed it only works if the Incident record has already been submitted or saved while the state = New.
There is a scenario where a new record can be created and moved direct to Resolved prior to being submitted or saved.
What is required to ensure the record is saved first?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 07:27 PM
Hi @Mark_10
In client script we have oldValue and newValue objects, from there you can easily findout what was the previous value.
Let me know if you need help in scripting that.
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2023 01:13 AM