How to get value from a reference field and copy it to the another reference field

naveenmyana
Giga Expert

Hi All,

I have a catalog item and have two reference fields, I have to get value from one reference field and copy that value to another reference field. I have tried the below script but it;s not working for me, Please suggest me the correct way here.

I have used Onload client script here...

function onLoad() {

var manager = g_form.getValue('Requesters_Manager');

alert(manager);

g_form.setValue('Resource_Manager',manager);

}

12 REPLIES 12

divya mishra
Tera Guru

Could you please check if Resource Manager pointing to the same table ?



Let me know if this was helpful


I wrote an onchange client script on caller field. Created a field named Caller2 pointing to sys_user table.


wrote the below code and it works :


function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue === '') {


          return;


    }


g_form.setValue("u_reference_1",newValue);


alert(Hello);


    //Type appropriate comment here, and begin script below


   


Let me know if this was helpful


alert ("Hello");


sorry missed the quotes.


Hello Divya,



Yes, Both are pointing to user table..


And I have also tried the below Onchange script..



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


    if (isLoading || newValue == '') {


          return;


    }




    //Type appropriate comment here, and begin script below


    var manager = g_form.getValue('requesters_manager');


alert(manager);


}