- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 05:58 AM
Hi,
I have created a variable set which should be visible only when the item is submitted via order guide.If the item submitted via catalog item the variable set should hide.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2017 05:53 AM
Sorry, I did indeed read that backwards. So, to have a variable be hidden on the Catalog Item, but visible on the Order Guide, you can do something like the following.
function onLoad() {
try {
if($("sysparm_guide")) {
return;
}
} catch(e) {
}
g_form.setDisplay('<name of your variable set here>',false);
}
Basically, $("sysparm_guide") will only work in an order guide and will fail on the Catalog Item, so you check if it exists (meaning you are on an order guide) and just return, and if it fails (meaning you're not in an order guide) you hide the variable set.
Kind of ugly, but should work.
Sorry for the confusion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 12:42 PM
Try something like this; in your variable set, create an onload client script
function onLoad() {
if($("sysparm_guide")) {
g_form.setDisplay('<name of your variable set here>',false);
}
}
That will check if you are in an order guide and then execute the command to hide the variable set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 10:23 PM
Hi,
The script you written was for order guide
function onLoad() {
if($("sysparm_guide")) {
g_form.setDisplay('<name of your variable set here>',false);
}
}
But i need for catalog item
function onLoad() {
if( $("current_item")) {
g_form.setDisplay('<name of your variable set here>',false);
}
}
Even i tried this but it is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2017 05:53 AM
Sorry, I did indeed read that backwards. So, to have a variable be hidden on the Catalog Item, but visible on the Order Guide, you can do something like the following.
function onLoad() {
try {
if($("sysparm_guide")) {
return;
}
} catch(e) {
}
g_form.setDisplay('<name of your variable set here>',false);
}
Basically, $("sysparm_guide") will only work in an order guide and will fail on the Catalog Item, so you check if it exists (meaning you are on an order guide) and just return, and if it fails (meaning you're not in an order guide) you hide the variable set.
Kind of ugly, but should work.
Sorry for the confusion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2017 06:11 AM
Thank Michael its working fine