script to get current cat item's request type to hide a variable on the form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 06:34 AM
Hi all, I have a scenario, I got stuck here. Please help me. I need a script to get the current catalog item's(sc_cat_item) request type(u_request_type) value. If the request type is purchase then show a particular variable from the variable set else hide it on the form in the portal.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 06:50 AM
Hi @Anusha27 ,
You can achieve this using Catalog UI Policies.
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 07:07 AM
Hi Basheer, Thanks for the response.
No, it's not possible because the variable is in the variable set and the dependent value Request Type (u_request_type) is from the sc_cat_item table. It should work on the portal view for all catalog items and order guides.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 11:33 AM
You could probably use a Display Business Rule to look up the item and put the Request Type into g_scratchpad then use the scratchpad value in your client script(s)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 12:14 PM
You should create an on-load Catalog Client Script that 1st hides the variable than makes a GlideAjax call to find out whether the field should be shown. You can obtain the id of the catalog item (in on-load Catalog Client Script) by calling g_form.getUniqueValue().