Not applicable

Hi @Reddymahesh ,

 

You cannot pass the value from client to server in that way because this "gsftSubmit(null, g_form.getFormElement(), "user_change_name");" will call the UI action again to run on server side and it will also declare again your FirstName and LastName variable, that is why they are undefined.

 

You can prompt user from Client side, then call GlideAjax to create new record with the user input, something like this:

 

function input() {
    var first = prompt("Please enter First name");
    var last = prompt("Please enter Last name");
	var fullName = first + ' ' + last;
    if (fullName != '') {
        var ga = new GlideAjax('testScriptInclude');
        ga.addParam('sysparm_name', 'testFunc');
        ga.addParam('sysparm_fullname', fullName);
        ga.getXML(processResponse);
    } else return false;
}

function processResponse(response) {
    var result = response.responseXML.documentElement.getAttribute("answer");
    action.setRedirectURL(current);
}

In Script include:

testFunc: function() {
        var gr = new GlideRecord('sc_req_item');
        gr.initialize();
        gr.assignment_group = '4a1d990547056510d2c3b604836d432e'; // ServiceNow admin team
        gr.description = 'Change the name to: ' + this.getParameter('sysparm_fullname');
        gr.insert();
},