Hide/Show choice options in Record Producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 09:31 AM
Hi @Ankur Bawiskar ,
I have a requirement to hide a particular choice option of Select Box variable based on the particular record selected in Reference Variable on the Record Producer.
I have written an Onchange Client Script for the implementation but now that choice option is hidden for all records selected in Reference Variable.
Here is the code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 09:46 AM
Hi @Nishant26,
Try this updated on change catalog client scripts on referenced variable.
if (newValue != 'sys_id of the particular record in reference variable') {
g_form.removeOption('Select box variable name', 'choice option');
}
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 10:10 AM - edited 08-18-2023 10:13 AM
Hi @Sagar Pagar ,
I have tried the above code, the choice option is not visible for other records except for that particular record, but now I have to refresh the form to show that choice option for that particular record of the reference variable. it is not automatically showing that choice option after selecting that particular record for which it should be visible.
is there any work around for this where I don't need to refresh the form to see that choice option after selecting that particular record in the reference variable considering I am first selecting one of those records for which it should be visible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 10:47 AM
Hi @Nishant26,
You need to set the Show Unique Values checkbox as true and use the below scripts. No need to refresh the form.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue != 'sys_id_of_record') {
g_form.removeOption('variable_name', 'value');
}else{
g_form.addOption('variable_name', 'value', 'lable');
}
}
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 06:34 AM
Hi @Nishant26,
Have you looked into my comments? let me know if you have any queries to solve this issue.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar