- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 07:39 AM - edited 12-13-2023 07:56 AM
Hi,
I am trying to auto-populate the mobile phone (mobile_phone) number field on the sys_user table with a numeric variable from a catalog item via a workflow script. I see that the user's record is being updated but the mobile phone number is still blank. If I change my script to populate the Business phone (phone) field instead, it works fine. The Mobile phone field has the E164 formatting on it and doesn't seem to be working. I believe it's the type of field, but I'm not sure how to change the script to make it work.
Here's my Run Script...
// Update User Profile with mobile number onSubmit.
var requestFor = current.variables.recepient;
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', requestFor);
gr.query();
if(gr.next()) {
gr.mobile_phone = current.variables.provide_the_mobile_phone_number; //If I change this to look at the phone field it works
gr.setWorkflow(false); // Turn off notifcations.
gr.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 09:22 AM
Out of the box the phone and mobile_phone fields are both the type of Phone Number, and both format a plain number string when entered through the UI. In a Fix script I can set the value on a user record to either a plain number string or a E164-formatted string on either field, and it shows the expected number (formatted or not) when I view the user record. Is the mobile_phone field in your instance a different Type? What is the value of the (string?) variable that the script is trying to populate?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:48 AM
If I'm picking up what you're putting down, I changed the mobile_phone field on the sys_user table in my PDI from Phone Number (as opposed to Phone Number (Unused), the plain one, deprecated or not, still works) to Phone Number (E164). To populate this field via script requires + with the country code, so trying to set it to '18008675309' results in a blank field/no change, but '+18008675309' works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:48 AM
If I'm picking up what you're putting down, I changed the mobile_phone field on the sys_user table in my PDI from Phone Number (as opposed to Phone Number (Unused), the plain one, deprecated or not, still works) to Phone Number (E164). To populate this field via script requires + with the country code, so trying to set it to '18008675309' results in a blank field/no change, but '+18008675309' works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:49 AM
Oh! okay I will try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:54 AM
Brad that worked. Okay I'll make a few updates to my variable to ensure the end-user enters the data a format the system will accept. Thank you for sticking this out with me!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 11:35 AM
You are welcome!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Can you share details on what was done?