How to get value from a reference field and copy it to the another reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 03:17 AM
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);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 03:19 AM
Could you please check if Resource Manager pointing to the same table ?
Let me know if this was helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 03:26 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 03:30 AM
alert ("Hello");
sorry missed the quotes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 03:30 AM
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);
}