Auto populate Location(location) Based on the Users selection.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 10:27 PM
My Requirement is in service catalog request we have two variables
1) reee_joiner_name (Type=Reference. Reference table is "sys_user")
2)Location(Type=SingleLine Text)
When we select the reee_joiner_name , Location will be autopopulate based on the reee joiner name for user.
I have written the below Onchange catalog client script ::
var Rejoin = g_form.getReference('reee_joiner_name',callback);
function callback(Rejoin){
g_form.setValue('phone_number',Rejoin.mobile_phone);
g_form.setValue('location',Rejoin.location);
}
According to this code Phone number will displaying fine. But in the Location field(location) they displaying the sys_id of the location. But my requirement is displaying Location name.
Please help me Regarding this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 02:55 AM
Yes, Chandra its good.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 03:41 AM
Hi @kommechandra,
If your onchange client scripts, then you will use newValue/ oldValue for selected variable or field.
locationGA.addParam("sysparm_user_id", g_form.getValue('reee_joiner_name'));
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2023 10:35 PM
Hi @Sitakanta Bej12,
Have you solved this? Let me know if have any queries.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 10:39 PM
Try this
var Rejoin = g_form.getReference('reee_joiner_name', callback);
function callback(Rejoin) {
g_form.setValue('phone_number', Rejoin.mobile_phone);
g_form.setValue('location', Rejoin.location.getDisplayValue());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 10:55 PM
Hi Harish,
I have also tried nothing will be displaying when we using getDisplayValue(); their