How to update catalog item fields via client script using getReference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 10:16 AM
I have a field on the catalog item called requested_for which is a sys_user reference field.
I want to update the location field on the catalog item to the location of the requested for user - which is not necessarily the current logged in user. I have a catalog client script like below but the req4 is 'undefined' when I print to screen.
How can this be accomplished?
function onChange(control, oldValue, newValue, isLoading) {
if (newValue) {
var req4 = g_form.getReference('requested_for',mycallback);
}
return;
}
function mycallback(req4){
if(!isLoading && newValue != oldValue){
g_form.setValue('requested_for_location', req4.location);
}
}
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 08:26 AM
when I type g_form in the editor it provides me with a .addInfoMessage option.
However I changed it to 'alert' and the value is still null.
It seems like all of my issue are in grabbing the value in requested_for for some reason.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 08:34 AM
addInfoMessage : my bad you can use both server and client..
just for troubleshoot can you try with below script.
function onChange(control, oldValue, newValue, isLoading) {
var caller = g_form.getReference('requested_for',mycallback);
function mycallback(caller) {
alert(caller.name);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 08:41 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 08:52 AM
is it possible if you can share your screen on webex? or google hangout i can try to help you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2018 10:44 AM
Than you. I had to go onto other stuff today.
I only have Skype but may be able to arrange hangout for friday if still willing.