Need help in passing value from UI Action to UI Page

Ahsan Zafar
Tera Contributor

 

 

I'm trying to achieve a requirement that if one of the field is populated via form directly, this value should pass to the modal window, 2nd field should be added via modal and then the incident should be moved to resolved sate...
UI Action:

function resolveIncident() {
    var resolutionCode = g_form.getValue('close_code');
    var closeNotes = g_form.getValue('close_notes');

    if (resolutionCode && closeNotes) {
        g_form.setValue('incident_state', 6);
        g_form.setValue('state', 6);
        g_form.setValue('resolved_by', g_user.userID);
        gsftSubmit(null, g_form.getFormElement(), 'resolve_incident');

    } else {
        var sysId = typeof rowSysId == 'undefined' ? gel('sys_uniqueValue').value : rowSysId;
        var gDialog = new GlideModal('resolve_incident_modal');

        gDialog.setTitle("Closure Information");
        gDialog.setPreference('sysparm_choices', JSON.stringify(g_scratchpad.resolutionCodeChoices));
        gDialog.setPreference('sysparm_sys_id', sysId);
        gDialog.setPreference('sysparm_table', 'incident');
        gDialog.setSize(600, 300);
        gDialog.render();
    }
}

if (typeof window == 'undefined')
    serverResolve();

function serverResolve() {
    current.incident_state = IncidentState.RESOLVED;
    current.state = IncidentState.RESOLVED;
    current.resolved_by = gs.getUserID();
    current.update();
    gs.setRedirect(current.getLink(true));
}

 

 

2 REPLIES 2

Dibyaratnam
Tera Sage

Is the question related to Workspace or native side in ServiceNow?

Ahsan Zafar
Tera Contributor

@Dibyaratnam For the first, It needs to be done on classic UI, then I'll work for workspace with same requirement