Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 10:42 AM
Try an intermediate variable perhaps? I'm thinking it's not actually storing the value in the variable after the prompt.
var FirstName;
var LastName;
var FullName;
function ChangeName() {
FirstName = prompt("Enter Firstname");
LastName = prompt("Enter Lastname");
if (FirstName && LastName) {
alert('Name captured is ' + FirstName + " " + LastName);
FullName = FristName + " " + LastName;
alert('Full name is ' + FullName);
}
gsftSubmit(null, g_form.getFormElement(), "user_change_name");
}
if (typeof window == 'undefined')
updateItem();
function updateItem() {
var gr = new GlideRecord('sc_req_item');
gr.initialize();
gr.assignment_group = '4a1d990547056510d2c3b604836d432e'; // ServiceNow admin team
gr.description = 'Change the name to: ' + FullName;
gr.insert();
action.setRedirectURL(current);
}