Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

GenAI Resolve Modal — Custom Resolution Codes Not Applying (close_code always shows default options)

fshakaib
Tera Contributor

Hi Everyone,

I am working on a customization where we want to override resolution code choices inside the GenAI Resolve modal (ui16_incident_resolve_modal) ONLY for specific conditions (Alert + specific Opened by).

What we did:

Created a custom UI Action (copy of Resolve_gen)

Added a custom block to inject allowed resolution codes:

g_scratchpad.modal_data = {
allowed_resolution_codes: [
{ value: "proactive_solved", label: "Proactively Solved" },
{ value: "reactive_solved", label: "Reactively Solved" },
{ value: "not_applicable_false_positive", label: "Not Applicable (False Positive)" }
]
};


Then we call the modal:

new sn_itsm_gen_ai.GenAIModalHelpers.openModal(
"ui16_incident_resolve_modal",
title,
"",
formValues,
null, // also tried passing modalOptions here
resolutionNotesUserTrigger
);


On the client script (UI Type: Desktop, OnLoad), we try to replace the dropdown values:

var allowed = g_scratchpad.modal_data.allowed_resolution_codes;
g_form.clearOptions("close_code");
allowed.forEach(function(opt){
g_form.addOption("close_code", opt.value, opt.label);
});

What works:

The alert debug shows that g_scratchpad.modal_data is receiving the custom array correctly.

Client script executes on modal load.

The actual issue:

Even though the allowed resolution codes reach the modal, the close_code dropdown still shows the default platform values, not our custom list.

It seems like the GenAI modal re-populates the close_code field after OnLoad, overriding our script.

What we need help with:

Is there an official or supported way to override the resolution code list inside ui16_incident_resolve_modal?

Does GenAI Resolve modal have an internal script that re-writes close_code options after our client script runs?

Is there any extension point or property to inject custom resolution choices into the GenAI modal?

Has anyone successfully modified resolution choices inside this modal?

Additional Info:

Actual field name is close_code, but Resolve configuration maps using the key resolution_code.

g_scratchpad values are reaching the modal correctly on our tests.

We want to override options only for Alert + specific Opened By.

Any pointers, extension points, or experiences with modifying GenAI modal behavior would be greatly appreciated.

0 REPLIES 0