The CreatorCon Call for Content is officially open! Get started here.

Resolve button not working

Pat Surtan
Tera Expert

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.

1 ACCEPTED SOLUTION

Pat Surtan
Tera Expert

Thanks for the reply guys. Turns out that my variables were misspelled so after fixing that it worked.

View solution in original post

5 REPLIES 5

Aman Kumar S
Kilo Patron

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 🙂

Best Regards
Aman Kumar

Hi Aman,

 

This is a custom table and not the Incident table. I am not using Incident_state field. Please advise.

Then use state value 6 for resolved, unless you have created State object for all the states, do not use State.Resolved

Best Regards
Aman Kumar

Abhijit4
Mega Sage

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

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP