g_form.getOption() doesn't work in Workspace - need an alterative
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 03:53 PM
Hello everyone. My current project has a requirement - when Category is set to a certain value, it adds an extra option to the Subcategory choices. To do this, I created a UI Policy with scripts like these:
Execute if true:
Execute if false:
This worked fine at first, but we later discovered that it didn't work when testing in the Workspace. After looking it up, I discovered that g_form.getOption() doesn't work in Workspace. Are there any alternatives I can use? I was using getOption() specifically to check to see if the extra Subcategory choice already existed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 06:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 07:09 AM
Hello, subhamdubey.
I did see that article earlier, but it does not seem like it would work for my use case. The algorithm I am trying to use is:
Does option <x> already exist?
If yes, do nothing
If no, add option <x>
The getDisplayValue() function appears to only get the currently selected option - it needs to be able to check on existing options without selecting one. If that's NOT how getDisplayValue works, please explain what it would do in this situation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 09:02 PM
Hi @Marc D
Is your subcategory field dependent on category field ? If yes, then you can't add options to subcategory field. Can you please confirm on this to debug it further ?
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 07:07 AM
Hello, Amit.
In this specific implementation, the Subcategory field is NOT dependent on the Category field. The addOption and removeOption functions work fine - it's the getOption function that doesn't work properly. I COULD remove the checking for duplicates, but then I risk having duplicates.