script to get current cat item's request type to hide a variable on the form

Anusha27
Tera Contributor

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. 

4 REPLIES 4

Basheer
Mega Sage

Hi @Anusha27 ,

You can achieve this using Catalog UI Policies.

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

Anusha27
Tera Contributor

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.

@Anusha27,

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)

-O-
Kilo Patron
Kilo Patron

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().