get reference value from a different table

karan_tarani
Kilo Contributor

Hi everyone,

I am trying to create a field on a category table and want to reference the default value of that field on a HR case table

For example:

Sub Category Value is REP1 for Category called Data/Report Request

find_real_file.png

I would like REP1 to populate on the HR case form when the Category Data/Report Request is selected.

find_real_file.png

Any Ideas on how i can achieve this?

1 ACCEPTED SOLUTION

Hi Karan,



Below script should actually work and shouldn't change the value back to the previous one. Can you put some alert as below?



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



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


return;


}


else if(newValue != oldValue){


alert('newValue is '+newValue);


var category = g_form.getReference('u_category', populateSubCategory);


}



function populateSubCategory(category) {


g_form.setValue("u_sub_category",category.u_sub_category);


}



}



Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

6 REPLIES 6

Hi Karan,



Below script should actually work and shouldn't change the value back to the previous one. Can you put some alert as below?



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



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


return;


}


else if(newValue != oldValue){


alert('newValue is '+newValue);


var category = g_form.getReference('u_category', populateSubCategory);


}



function populateSubCategory(category) {


g_form.setValue("u_sub_category",category.u_sub_category);


}



}



Please mark this response as correct or helpful if it assisted you with your question.

Thanks Sanjiv, turns out there was a business rule that was updating the value to default, i have disabled it and its working fine. Thanks a bunch for your help