To fetch Userid of the Requested for user on the catalog form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 10:37 AM
Hi All,
I want to fetch the userid of the "Requested for" user from the catalog form.
example - I have a field Requested for on the catalog form.
I want to fetch the user id of this Requested for user on the Onchange catalog client script
for example - Requested for user is - Rahul Sharma , so i want the user of the user - Rahrma (combination of first and last name).
Pls help with solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 12:08 PM
If you ultimately only need the value, like user id to populate in another variable, try the code-less approach:
If you actually need the value (Rahrma) to further use in the same script, then you'll want to use a getReference with callback to lookup the value on the user table field based on the selected user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 02:04 AM
@Brad Bowman : can you please help me with the logic , I need to fetch the value of the (Requested for) user id and need to store it in the input variable. Instead of sys_id , I want user id. It will be great of you can help with the code/script.
var userID = g_form.requested_for.sys_id;
var inputs = {};
inputs['user_sys_id'] = userID; // String
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 04:05 AM
function onChange(control, oldValue, newValue, isLoading) {
g_form.getReference('requested_for', getUser);
}
function getUser(caller) {
var userID = caller.user_name
}
