Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Corrent ActionName is not populating for Close Complete in Workspace

jitusingh
Tera Contributor

Hi All,


When I am trying to execute onSubmit Client script using actionName="closeComplete" Condition, but everytime actionName is coming as "sysverb_ws_save" , and client script is not running. 

I am trying to execute glidemodal pop up when actionName='closeComplete'.
Workspace = HR Agent Workspace

Any solution will be highly appreciated.

Here is my onSubmit Client Script code:

function onSubmit() {
 
var action_name = g_form.getActionName();
alert('Jitu Action = '+action_name);
 
         if(action_name == 'closeComplete') {
alert('enter glide modal');
var messages = [
        'Close notes', 'Closed Reason', 'Reason',
        'Provide a reason for closing the case as complete.'
    ];
 
    var reasons = [{
        "displayValue": "Cancellation Requested",
        "value": "Cancellation Requested"
    }, {
        "displayValue": "Incorrect Case Record Type",
        "value": "Incorrect Case Record Type"
    }, {
        "displayValue": "Missing Information",
        "value": "Missing Information"
    }, {
        "displayValue": "Redirected",
        "value": "Redirected"
    }, {
        "displayValue": "Resolution Provided",
        "value": "Resolution Provided"
    }, {
        "displayValue": "Knowledge – based Resolution: Article Fully Resolved Case",
        "value": "Knowledge – based Resolution: Article Fully Resolved Case"
    }, {
        "displayValue": "Knowledge – based Resolution: Article Used with Agent Support",
        "value": "Knowledge – based Resolution: Article Used with Agent Support"
    }, {
        "displayValue": "Knowledge – based Resolution: Article Inaccurate or Incomplete",
        "value": "Knowledge – based Resolution: Article Inaccurate or Incomplete"
    }, {
        "displayValue": "Knowledge – based Resolution: No Article Available",
        "value": "Knowledge – based Resolution: No Article Available"
    }, {
        "displayValue": "Service Processing - Transaction",
        "value": "Service Processing - Transaction"
    }, {
        "displayValue": "Duplicate Case",
        "value": "Duplicate Case"
    }, {
        "displayValue": "Resolution Provided by Vendor",
        "value": "Resolution Provided by Vendor"
    }];
 
    getMessages(messages, function() {
        var fields = [{
                type: 'choice',
                name: 'reason',
                label: getMessage('Reason'),
                value: (reasons && reasons.length > 0) ? reasons[0].value : '',
                choices: reasons
            },
 
 
            {
                type: 'textarea',
                name: 'work_notes',
                label: getMessage('Close notes'),
mandatory: true
            }
        ];
 
        var sysId = g_form.getUniqueValue();
        var tblName = g_form.getTableName();
 
        g_modal.showFields({
            title: getMessage('Closed Reason'),
            fields: fields,
            instruction: getMessage('Provide a reason for closing the case as complete.'),
            size: 'md'
        }).then(function(fieldValues) {
            //get the work note entered
            var newReason = fieldValues.updatedFields[0].value;
            var newWorkNote = fieldValues.updatedFields[1].value;
 
            //Call the Ajax function that handles adding worknotes and state
            var s = new GlideAjax("sn_hr_core.ConnectMeHRUtils");
            s.addParam("sysparm_name", "closedCaseAction");
            s.addParam("sysparm_obj_id", sysId);
            s.addParam("sysparm_table_name", tblName);
            s.addParam("sysparm_work_note", newWorkNote);
            s.addParam("sysparm_suspend_reason", newReason);
            s.getXML(addWorkNotes);
 
            function addWorkNotes(response) {
                g_form.save();
            }
        });
    });
 
}
 
 
}
5 REPLIES 5

@jitusingh 

so what debugging did you do?

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