
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 03:14 AM
Hi, I have a variable set which is used on about 100 record producers. I have added a field to the variable set which is populated with the contact phone number of the user. I also have a checkbox next to it. If selected, the phone number field is no longer read only and the user can update.
Onsubmit, if this field is checked, I want this to update the record on the sys_user table with the new phone number.
As the variable set is on 100 RP's, I dont want to go into every single RP to add to the script.
Is there a way I can do this with an OnSubmit catalog client script similar to how the map to field functionality works?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 09:00 AM
Hi @M_iA ,
Try the below script.
var checkboxResponse = g_form.getValue('update_my_profile');
if (checkboxResponse == 'true' || checkboxResponse == true) {
var ga = new GlideAjax('global.CustomerHelpCenterUtils');
ga.addParam('sysparm_name', 'setContactNumber');
ga.addParam('sysparm_number', g_form.getValue('contact_number'));
ga.addParam('sysparm_user', g_form.getValue('contact'));
ga.getXMLAnswer(myCallbackFunction);
function myCallbackFunction() {
return;
}
Mark helpful and accept the solution if it helps in Solving your query
Regards,
Johns
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 08:42 AM - edited 03-10-2023 08:43 AM
Hi @M_iA ,
I think you are missing one line.
var checkboxResponse = g_form.getValue('update_my_profile');
g_form.addInfoMessage(checkboxResponse);
if (checkboxResponse == 'true' || checkboxResponse == true) {
var ga = new GlideAjax('global.CustomerHelpCenterUtils');
ga.addParam('sysparm_name', 'setContactNumber');
ga.addParam('sysparm_number', g_form.getValue('contact_number'));
ga.addParam('sysparm_user', g_form.getValue('contact'));
alert('I got here');
ga.getXMLAnswer();
}
Try This script and see if its working or not. Also check if the addinfoMessage that was added is getting triggered as well.
Regards,
Johns

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 08:49 AM
Thats deffinately a step forward @Johns Marokky
It is now updating the number, but I am getting
and in the console, im getting:
Unhandled exception in GlideAjax.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 09:00 AM
Hi @M_iA ,
Try the below script.
var checkboxResponse = g_form.getValue('update_my_profile');
if (checkboxResponse == 'true' || checkboxResponse == true) {
var ga = new GlideAjax('global.CustomerHelpCenterUtils');
ga.addParam('sysparm_name', 'setContactNumber');
ga.addParam('sysparm_number', g_form.getValue('contact_number'));
ga.addParam('sysparm_user', g_form.getValue('contact'));
ga.getXMLAnswer(myCallbackFunction);
function myCallbackFunction() {
return;
}
Mark helpful and accept the solution if it helps in Solving your query
Regards,
Johns

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 09:11 AM
Thanks @Johns Marokky
Its working as expected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 05:09 AM
Hi @M_iA ,
Can you make sure that the onSubmit and Script include are created on the same scope.
And its accessible by all scopes.
Mark helpful if it helps in solving your query.
Regards,
Johns