We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Resolve button popup

George_1
Tera Guru

In native ui and SOW I am getting the popup but not in CSM workspace. 

George_1_0-1784714178465.png

function resolveIncident() {
	
    var configFields = {
        resolution_notes: getConfigField('resolution_notes'),
        resolution_code: getConfigField('resolution_code')
    };

    if (noGenAIResolve() || !hasConfigFields(configFields) || g_form.isNewRecord()) {
		g_form.setValue('incident_state', 6);
        g_form.setValue('state', 6);
        g_form.setValue('resolved_by', g_user.userID);
        var sysverb = g_form.isNewRecord() ? 'sysverb_insert' : 'sysverb_update';
        gsftSubmit(null, g_form.getFormElement(), sysverb);
        return;
    }

    var formValues = {};

    formValues[configFields.resolution_code] = g_form.getValue(configFields.resolution_code);
    formValues[configFields.resolution_notes] = g_form.getValue(configFields.resolution_notes);

    g_scratchpad.originalState = g_form.getValue('state');
    g_scratchpad.setValueMap = {
        incident_state: 6,
        state: 6,
        resolved_by: g_user.userID
    };
    var title = getMessage('Resolve');
    ScriptLoader.getScripts("sn_itsm_gen_ai.GenAIModalHelpers.jsdbx", function() {
        new sn_itsm_gen_ai.GenAIModalHelpers.openModal('ui16_incident_resolve_modal', title, '', formValues);
    });
}

function getConfigField(field) {
    if (!g_scratchpad.resolutionSkillConfig)
        return '';

    return g_scratchpad.resolutionSkillConfig[field] ? g_scratchpad.resolutionSkillConfig[field] : '';
}

function noGenAIResolve() {
	var roles = g_user.roles;

	if (Array.isArray(roles)) 
		return !(roles.indexOf('itil') >=0 || roles.indexOf('sn_incident_write') >=0 || roles.indexOf('admin') >= 0 || roles.indexOf('itil_admin') >=0);

    return true;
}

function hasConfigFields(config) {
    if (!config.resolution_notes && !config.resolution_code)
        return false;

    return (!config.resolution_notes || g_form.hasField(config.resolution_notes)) && (!config.resolution_code || g_form.hasField(config.resolution_code));
}
1 REPLY 1

Ankur Bawiskar
Tera Patron

@George_1 

I will suggest train your agents to use SOW as it's used for incidents and CSM workspace is mostly to work on cases

if you still want then check below

Enabling SOW Actions in CSM/FSM Configurable Workspace 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader