- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2020 01:52 AM
Hi everyone,
I've an order guide which has 5 catalog items in it. On entering the details in first page while placing the order in service portal, the fields are cascading to the next page "choose options". Here I've to make the fields read only which were cascaded from previous page. This I've done and working as expected while requesting order guide.
But the problem is when I'm ordering the individual catalog items, the fields which I've made read only becoming read only and not able to select anything. Please help me on making it applicable only when ordered through order guide.
I've written the below script in every included catalog items UI Policy, to make it applicable only in order guide.
//execute if true
function onCondition() {
var item = g_form.getValue("sysparm_guide");
if(item == 'sys_id_of_order_guide'){
return true;
}
}
//execute if false
return false;
Please suggest me on this.
Thanks in advance!
Regards,
Sindhu
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2020 02:06 AM
Hi,
Easiest way is to create a variable set and create a 'Yes/No' variable in the set. Hide this field always on the form. Include this variable set on the catalog items. Then create UI policy on the catalog items to make fields read-only on order guide. Use variable set variable to identify the item opened through order guide.
Use below onLoad client script on variable set to set the variable value.
function onLoad() {
//Type appropriate comment here, and begin script below
//portal
try{
var isOrderGuide = g_service_catalog.isOrderGuide();
if (isOrderGuide) {
var urlString=top.location.toString();
if((urlString.indexOf('sc_cat_item_guide')>-1) && (urlString.indexOf('sys_id=0890bb30dbdef78069adba213996190e')>-1) )//check if it is part of order guide.Update the sys_id of the guide
g_form.setValue('orderGuide','Yes'); //replace with variable name
}
}
//Desktop code
catch(e) {
var guide=g_form.getParameter("sysparm_guide");
if(guide=='0890bb30dbdef78069adba213996190e')//check if it is part of order guide. Update the sys_id of the guide
g_form.setValue('orderGuide','Yes');//replace with variable name
}
}
Include the variable set on catalog items. Create a UI policy on those catalog items to make fields read-only.
Ex: UI policy
condition: orderGuide is Yes
UI policy action : select the field and set read-only true.
If I have answered your question, please mark my response as correct and/or helpful.
Thanks,
Suseela P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2020 06:00 AM
Hi Suseela,
I've added an else condition, then it worked for me. Thanks a lot for the quick response. It helped me very much.
Regards,
Sindhu Musunuri

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2020 02:01 AM
Hi Sindhu
Try this onload catalog client script (assuming this is on a variable set?).
var thisGuide = $("sysparm_guide").value;
var thisItem = $("current_item").value;
if(thisGuide == thisItem) {
g_form.setReadOnly('Myvariable', true);// write your variable name
}
This should make the variable read-only as the order guide loads (or if you navigate back to the Describe Needs screen) but would take no action when a catalog item is loaded (when you click choose options).
If it help mark helpful or correct
Thanks and regards
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2020 10:39 AM
not working script is throwing an error on portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2020 10:39 AM
Have you got this worked? tried the same but its not working for me

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2024 03:02 PM
The solution marked correct works. Make sure your Yes/No variable in the variable set has a default value of No