Best way to track user changes to "My Profile"?

SC10
Kilo Guru

Has anyone seen a good way to track user changes to their "My Profile" and kick off requests/workflows from those changes?

Example: An end user changes their Department information. This would then log an automated request with a workflow that shoots off tasks to Server Admins to update the user's information in Active Directory, task to Admin to update user's desk location, etc etc. Similar activities to those.

Looking for anyone else who might have done something like this, or seen it in action.


Thanks.

1 ACCEPTED SOLUTION

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Mike's wizard approach is fine too, but here is an example of what I was referring to:


Create a new catalog item to accept the updates.   In my simple example I prompt for mobile phone and department.   Each of these variables has a default value of:


Mobile Phone: javascript:gs.getUser().getMobileNumber();


Department: javascript:gs.getUser().getDepartmentID()



These functions can be found here: http://wiki.servicenow.com/index.php?title=Getting_a_User_Object#gsc.tab=0



Then create a UI action to call this new catalog item from the user profile.   I set mine as a button and the script to run is basically the URL link from your service catalog.   I went to the catalog and right clicked on the item and chose "copy link address" in Chrome.   Once you have that, the script in the UI action should look similar to the following:


action.setRedirectURL("com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=9f1b256f0f2c460088641d2be1050ed1&sysparm_link_parent=e15706fc0a0a0aa7007fc21e1ab70c2f&sysparm_catalog=e0d08b13c3330100c8b837659bba8fb4&sysparm_catalog_view=catalog_default");




Once setup, here is the user profile with fields read only and button:


find_real_file.png




Then once you click Update Profile, this shows up:


find_real_file.png



From there your workflow can do whatever you need like update the user's record in ServiceNow and also create tasks to your fulfillers to update the external databases.


View solution in original post

9 REPLIES 9

Or you can create a wizard and send it to the wizard with the current values populating variables.


Do you have a demo of this dynamic variable type working in wizards? The demo data doesn't seem to be using that at all.


We did something like this:



function onChange(control, oldValue, newValue, isLoading) {



  if (isLoading)


  return;



  var gr = new GlideRecord('sys_user');


  gr.get(newValue);


  updateUserDetails(gr);


}



function updateUserDetails(){




g_form.setValue('name', gr.name);


g_form.setValue("email', gr.email);




etc, etc...




}




We did this at the beginning of a panel, and the user chose the variable that is in newValue, but this should be transferable to an onLoad.



Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Mike's wizard approach is fine too, but here is an example of what I was referring to:


Create a new catalog item to accept the updates.   In my simple example I prompt for mobile phone and department.   Each of these variables has a default value of:


Mobile Phone: javascript:gs.getUser().getMobileNumber();


Department: javascript:gs.getUser().getDepartmentID()



These functions can be found here: http://wiki.servicenow.com/index.php?title=Getting_a_User_Object#gsc.tab=0



Then create a UI action to call this new catalog item from the user profile.   I set mine as a button and the script to run is basically the URL link from your service catalog.   I went to the catalog and right clicked on the item and chose "copy link address" in Chrome.   Once you have that, the script in the UI action should look similar to the following:


action.setRedirectURL("com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=9f1b256f0f2c460088641d2be1050ed1&sysparm_link_parent=e15706fc0a0a0aa7007fc21e1ab70c2f&sysparm_catalog=e0d08b13c3330100c8b837659bba8fb4&sysparm_catalog_view=catalog_default");




Once setup, here is the user profile with fields read only and button:


find_real_file.png




Then once you click Update Profile, this shows up:


find_real_file.png



From there your workflow can do whatever you need like update the user's record in ServiceNow and also create tasks to your fulfillers to update the external databases.


Cheers, this looks to be exactly what I had in my mind. Happy to know others have smart solutions out there that everyone can learn from in this community!