- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 08:56 PM
Hi Experts,
I have a requirement for a record producer as mentioned below:
I have created two variables in a record producer. The first variable is a Reference type and the second variable is also a reference type variable. For the second variable, I'm using a custom table and a reference qualifier to populate values from the first variable's reference table.
When the first variable value is changed, the second variable value should also be changed. But the second variable's value is not changing.
I have created an onChange client script but it's not working.
Let me know if I'm missing anything.
Thanks in advance,
Amol
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 09:40 PM
Hello @Amol Pawar ,
Please try below code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue) {
g_form.setValue('infosys_entity ', ' ');
}
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Pratiksha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 09:10 PM
Hi @Amol Pawar
since it is reference field clearValue will not work, you need to use setValue
use g_form.setValue('fieldname',''); // clear the value
additional note you can place this line inside if at line 2
g_form.setValue('fieldname',''); // clear the value when first variable is empty
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 09:40 PM
Hello @Amol Pawar ,
Please try below code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue) {
g_form.setValue('infosys_entity ', ' ');
}
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Pratiksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 10:09 PM
Hello @Amol Pawar ,
When working with reference-type variables, it's recommended to use the setValue function with an empty value for effective clearing, rather than relying on the clearValue function.
You can refer the below code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue) {
g_form.setValue('infosys_entity', ''); // Clear the value of 'infosys_entity'
}
}
Kindly mark the answer ✔️Correct or Helpful ✔️If it addresses your concern.
Regards,
Aniket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 10:32 PM
Hi @Amol Pawar
You can use Auto-Populate feature to achieve this without writing a single line of code. Refer below post and make the modifications accordingly.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.