- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 10:03 AM
In a scenario, where in you have a reference field and a reference qualifier condition is already set.
Now, what if you have a requirement to modify the results of the reference field based on form change or depending on another field present on the same form?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 10:13 AM
this is achievable with an on-change client script, if you have to glide record to obtain certain records, then create a script include and use glide ajax to call the SI.
g_form.addOption() doesn't work for reference fields.
but g_form.removeOption() will work if you want to remove certain options from the reference fields.
replacement for g_form.addOption() could be g_form.setValue('field','sys_id');
if you have to display multiple options under these reference fields, then you can simply create a for loop and use g_form.setValue('field', response[i]);
advantage of using g_form.setValue() is it will help in adding multiple field choices on a reference field.
ex:
g_form.setValue('type', 'sysid1');
g_form.setValue('type', 'sysid2');
for(var i=0;i<length;i++)
g_form.setValue('type', response[i]);
Hope it is clear, please let me know if you're unable to achieve this.
Thanks,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 10:13 AM
this is achievable with an on-change client script, if you have to glide record to obtain certain records, then create a script include and use glide ajax to call the SI.
g_form.addOption() doesn't work for reference fields.
but g_form.removeOption() will work if you want to remove certain options from the reference fields.
replacement for g_form.addOption() could be g_form.setValue('field','sys_id');
if you have to display multiple options under these reference fields, then you can simply create a for loop and use g_form.setValue('field', response[i]);
advantage of using g_form.setValue() is it will help in adding multiple field choices on a reference field.
ex:
g_form.setValue('type', 'sysid1');
g_form.setValue('type', 'sysid2');
for(var i=0;i<length;i++)
g_form.setValue('type', response[i]);
Hope it is clear, please let me know if you're unable to achieve this.
Thanks,
Sumanth