Catalog Client Script for auto populate Department not working for Lookup Select box field type

sbungener
Kilo Contributor

I have implemented a small Catalog Client Script to auto populate Department based on the caller in a Service Catalog item.

But I had initially issues get it to work and I found out that the cause was because the department field was a Lookup Select box. When I changed it to a reference field, it did work. I rather would like to have it a Lookup Select box, does anyone know how to get this to work?

 

Here is the script:

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

    if (isLoading)

          return;

    if (newValue == '') {

g_form.setValue('department', '');

          return;

    }

    if (!g_form.getControl('department'))

          return;

    var caller = g_form.getReference('caller_id', setdepartment);

}

function setdepartment(caller) {

    if (caller)

g_form.setValue('department', caller.department);

}

 

6 REPLIES 6

Thank you, I will try this out later this week


jfcoutu
Mega Contributor

Hello,



has anyone actually came out with a solution to this question?



I have a reference field in a variable set that needs to be autopopulated with the sc_cart requested_for Manager



and I've tried the above solutions and does not seem to work.