- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 11:08 AM
Hello,
I have the following two variables, reference and lookup select box. The variables are getting data from the same table: u_part_number
On the "lookup select box", I am using Auto-Populate to fill in the Part Id variable.
How to you clear Part Id variable on Part number changes.
Here is the onChange script I have tired, but it did not work. Please help. Thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 12:50 PM
@Lisa Goldman Strange , but anyways you can give another try.
Set 'Include none' as true on your Lookup select box variable and now use below script.
eg:
function onChange(control, oldValue, newValue, isLoading) {
if (newValue == '') {
g_form.removeOption('part_id','');
g_form.addOption('part_id', '', '');
}
}
Thanks,
Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 11:31 AM
Hey @Lisa Goldman,
Looks like you are using the auto-populate functionality. If so, there is no need to write a client script.
Deactivate the client script and see if it works.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 11:55 AM
Hi @James Chun
I have tried deactivate the client script, but that did not work. That is the reason why I am seeking the community advice on how to handle this. Thank you for helping.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 12:00 PM
Right, it might be because it's lookup select box type.
Can you try removing all the code after line 6 and replace it with the following:
if(newValue == ''){
g_form.clearValue('part_id');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 12:10 PM
Hi @James Chun
I have tried your suggestion code and it behavior remains the same.
I modified the type to reference and it works fine without and code, but it did not work on the look up select box type and I do not know why.