Update User profile on Catalog Item submission from Service Portal.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 08:56 AM
Hello,
I am trying to update the User profile values when a catalog form is submitted. I am using a Multiple Variable Set of current User values, then if the user changes any values when the form is submitted the values should be updated for the identified user (u_user). Code is not working and I am failing to see what is wrong. I am getting a good user sys_id but the script doesn't appear to enter while loop.
function onSubmit() {
// Update User Profile onSubmit.
var requestFor = g_form.getValue('u_user');
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', requestFor);
gr.query();
while (gr.next()) {
alert('Entered while');
gr.email = gr.getValue('u_user_email');
gr.location = gr.getValue('u_user_location');
gr.manager = gr.getValue('u_user_manager');
gr.phone = gr.getValue('u_user_business_phone');
gr.setWorkflow(false); // Turn off notifcations.
gr.update();
}
}
onSubmit();
Thank you,
-Wesley

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 09:34 AM
Yes, getting current values from the form and then setting them to the user profile.
Trying to do script in Multi-Variable Set (MVS) client script during submission or could do onChange on the catalog form vs. updating all workflows behind each catalog item. Much more work to update each catalog item's workflow. Hope this makes sense.
Haven't played with Flow Designer much yet. What would be the trigger to run the flow and know which catalog forms may have or not have the MVS in them?