Hello @ibrahim,
There are a few items that I can see that might be affecting your results. There are different ways to perform this. Also, check your caps if they are needed or not.
Using your current example:
"${customOptions.ocategory == 'web' ? 'web': ${customOptions. == 'app' ? 'app':'db'}}"
In the above, you only need one set of ${ }
, which everything inside of it will be evaluated as code. Alternatively, you can also use <%= %>
instead of ${ }
.
Also, It looks like you might be missing the ocategory
after customOptions.
This is what I would expect a finished item to look like:
"${customOptions.ocategory == 'web' ? 'web' : customOptions.ocategory == 'app' ? 'app':'db'}"
Another way to write this in a more expanded way:
"${if(customOptions.ocategory == 'web'){'web'}else if(customOptions.ocategory == 'app'){'app'}else{'db'}}"
Shorter ways possibly:
"${if(customOptions.ocategory != 'db'){customOptions.ocategory}else{'db'}}"
or
"${customOptions.ocategory != 'db' ? customOptions.ocategory : 'db'}"
That said, there is another alternative than building in logic, if it is as simple as the above. You can do the following using an Option List:
In the above Manual Option List, it is in CSV format (JSON and others work as well). The first item (before the comma) is what shows in the Input in the UI and the second item (after the comma) is the value that is passed into the variables.
In this case, you would just need to use:
"${customOptions.ocategory}"
Depending on the choice the user made, it will just fill in the correct value.
Hope that helps!