Hide varaible set on catalog item but keeping visibility on order guide

s_nandhini
Tera Contributor

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.

1 ACCEPTED SOLUTION

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.


View solution in original post

8 REPLIES 8

miked_jones
Giga Expert

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.


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


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.


Thank Michael its working fine