- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 03:12 AM
Hi,
I have two fields with same name (company) one is reference field another is string field.Based on some conditions i need to auto populate reference field value in string field.
condition:
1. if company field(string) is empty:
what i chosen in company field(reference) that need to auto populate in company field(string).
2. if company field(string) is not empty:
what i chosen in company field(reference) that not need to auto populate in company field(string).
Can any one help me how can i achive this?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 04:10 AM
Try replacing
var companyis = g_form.getValue('companyref');
if (companyis != '') {
with
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var companyis = g_form.getValue('companyref');
var companystris=g_form.getValue('companystring');//replace companystring field correctly
if(companystris=='') //execute below only if company string is empty
{
if (companyis != '') {
var compis = g_form.getReference('companyref', callback); //Replace companyref with correct field name for reference
function callback(compis) {
g_form.setValue('companystring', compis.name);
}
}
else { //if companyis empty then clear value for companystring
g_form.clearValue('companystring'); //Replace correct string field name for company
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 04:55 AM
The solution suggested by Willem will work for you, we have implemented similar kind of requirement with the combination of BR and UI policy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 05:18 AM
Thank you Narasimha,
Can you mark it as helpfull?👍