- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2022 10:43 AM
I am trying to recreate a resolve button for my form using the Incident Resolve button as a guide. It should work like the resolve button for incidents to a certain extent. I am not using Resolved by so I commented that line out. When you click on Resolve, the state field changes to Resolved (this part works), and mandatory fields will be set for the user to enter a comment, but the state is not Resolved as it stays with the current state value it already has. This UI action is not working and I am not sure why. Also, how do I stamp the variables into the Activities field like the image attached?
Screenshot of my ui action and Activities section are attached. Any help is appreciated, thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2022 11:16 PM
Thanks for the reply guys. Turns out that my variables were misspelled so after fixing that it worked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2022 12:05 PM
Hey,
Update your server code to:
function serverResolve(){
current.incident_state = IncidentState.RESOLVED;
current.state = IncidentState.RESOLVED;
current.resolved_by = gs.getUserID();
current.update();
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2022 12:40 PM
Hi Aman,
This is a custom table and not the Incident table. I am not using Incident_state field. Please advise.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2022 10:19 PM
Then use state value 6 for resolved, unless you have created State object for all the states, do not use State.Resolved
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2022 10:28 PM
Hi,
Try using g_form.save() on client side code, you don't need to write server side code rather just use below 2 lines of code,
g_form.setValue("state",6);//make sure that resolved backend value for the custom table field is 6 otherwise change accordingly
g_form.save();
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Community Rising Star 2022
Regards,
Abhijit
ServiceNow MVP