- 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 12:06 PM
@Lisa Goldman You don't need client script to clear the value. It will auto clear it once you change the reference variable value.
Please make sure, you have checked "Include none" in your lookup select box variable ?
Thanks,
Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 12:20 PM
I'm sure your suggestion will work because I have already tried. Is it possible to leave the variable blank? Currently, it displays "none" when left empty. Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 12:33 PM
@Lisa Goldman no, that wont be possible, also none is empty from scripting perspective.
May I know why are you not going with none option ?
Or may be you can use single line text field to auto populate and set empty based on your need . no scripting required here.
Thanks,
Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 12:50 PM
I am trying to understand why it works with the reference type but not with the lookup select box type. This is for my learning purposes. I will use the reference type instead.
Thanks to everyone who is trying to help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 01:45 PM
@Lisa Goldman I tried to investigate a little bit more into my personal instance, here is my solution. please try , tested on my PDI and working.
function onChange(control, oldValue, newValue, isLoading) {
if(newValue=='')
g_form.addOption('part_id', '', '');
}