Incident field displays "-" after clicking on UI action in SOW before populating the actual value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
We have a UI Action that pauses the incident record and sets the value of Pending Reason field to '30'. In the backend it works as expected. However, in the Service Operations Workspace, when pausing the ticket, the Pending Reason is blank (displaying "-" as in the screenshot below). It is greyed out and after saving populating the correct value, but it might be confusing for agents.
Piece of UI action Workspace script:
function onClick() {
try {
var ga = new GlideAjax('example_ajax');
ga.addParam('sysparm_name', 'getPendingData');
ga.addParam('sysparm_incidentID', g_form.getUniqueValue());
ga.getXMLAnswer(function(response) {
var result = JSON.parse(response);
if (result.apply) {
g_form.setValue("hold_reason", "30");
g_form.setValue("due_date", result.due_date_display);
} else {
if (g_form.getValue("u_type") === "complaint") {
g_form.setValue("hold_reason", 20);
}
}
// Call the UI Action and skip the "onclick" function
g_form.submit("pause_incident"); // MUST call the "Action name" set in this UI Action
});
} catch (oErrMsg) {
alert("UI Action:Pause Incident; function: pauseIncident. Error Message received from Try/Catch: " + oErrMsg);
}
}
How could I show the field on the form in SOW only when it is already populated with the correct value?
I would be grateful for any hints.
Best regards!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
is it going inside that IF and setting the value?
seems some script is running in SOW which is clearing that again?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader