Hiding a variable on catalog item level
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Greetings,
I have a requirement to hide a variable on catalog item (order guide really). I am trying to achieve this requirement through a UI Policy or alternatively through a Catalog UI Script. But for some reason the variable keeps on displaying on the catalog item view, I am not why and how this happening. See my configs below.
Client script configs:
UI Policy configs:
Result:
Please be advised that I am not implementing both at once, I tried both the above solutions but I am not getting the desired results.
Many thanks,
Kamva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited 3 hours ago
Hi @Kamva1
What is your use case?
In associated UI Policy action , for Request type variable, Make visible =false ( Mandatory should be false in that case) if you want to hide.
Note: I am sure at some condition, you need to hide the variable, Update the condition properly in your ui policy .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @Kamva1 ,
Why the variable keeps showing
- The client script calls g_form.setDisplay('request_type', true), which shows the variable. The second argument must be false.
- The Catalog UI Policy action has Visible = True, so it also shows it. It must be False.
- Both records have only “Applies on Requested Items” ticked. Your screenshot is the Choose Options step, which is the catalog item view, so neither record runs there. Tick Applies on a Catalog Item view on both.
Option A: Catalog UI Policy (recommended)
- Applies on a Catalog Item view: ticked
- Applies on Requested Items: ticked (optional)
- On load: ticked
- Conditions: leave empty
- Policy action on request_type: Visible = False, Mandatory = False, Read only = Leave alone
Mandatory must be False because a hidden mandatory variable can block submission.
Option B: Catalog Client Script
Keep UI Type as Mobile / Service Portal, and tick Applies on a Catalog Item view. Use this script:
function onLoad() {
g_form.setDisplay('request_type', false);
}
Recommendation
I recommend using only one approach, either a Catalog UI Policy or a Catalog Client Script, to control the visibility of the variable.
Avoid maintaining both configurations for the same requirement, as conflicting visibility settings can make troubleshooting difficult. Also, remember that Catalog UI Policies execute on supported catalog forms and views where they are configured to apply.
Try the Catalog UI Policy approach first and check whether the variable is hidden in the Choose Options step.
Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards,
Tarun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
you want to show that variable only when Catalog item is included within order guide?
what's your exact requirement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @Kamva1 ,
I don't think the issue is only related to the UI Policy or Client Script (using setDisplay('request_type',false)) itself.
Based on the screenshot you attached, it looks like you are accessing the catalog item through the Service Portal. However, the UI Policy or Client Script seems to be configured to apply only to the Requested Item (RITM), meaning it will only take effect in the RITM variable editor.
Could you please check the following configurations?
Set Applies on to A Catalog Item view.
Set UI Type to All to ensure that the UI Policy or Client Script is applied across all supported interfaces, including Workspace.
I hope this helps! If this resolves your issue, please mark the response as helpful and accept it as the solution.
Regards,
Harish