Is it possible to make variables visible on SCTasks when coming from order guides only?

Cody17
Tera Contributor

Hello,

 

I have a requirement to make certain variables only be visible on SCTasks when coming from an order guide and not be visible when submitted from the standalone catalog item.  I tried making sure cascade variables was set to true and marking global as true on these variables within the order guide, but this did not work.  Is this possible, and if so, what is the best way to achieve this?

 

Thanks,

Cody

2 REPLIES 2

AshishKM
Kilo Patron
Kilo Patron

Hi @Cody17 , 

The cascade checkbox copies the variable value from order guide to catalog if both has same variable name/type.

As you have tricky situation and using catalog item in both ways, you can add some hidden variable coming from order guide and make it true if request open via order guide and check that variable value within the catalog client script to display/or/not-display some variables based on need.

 

  • Create that Boolean/True-False type variable in order guide and catalog item both
  • Keep default value false.
  • On Submit from Order Guide make this variable value True which will cascade to catalog, and script will trigger to take action.

Please test this simple logic and share the output.

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Ankur Bawiskar
Tera Patron
Tera Patron

@Cody17 

you will have to identify if RITM is generated as standalone or part of Order Guide.

1) create hidden variable of type string and always hide it using UI policy, set it with higher order

2) write onLoad catalog client script and check URL is normal or order guide is there, based on that store the value

function onLoad() {

    var url = top.location.href;
    if (url.indexOf('sc_cat_item_guide') > -1)
        g_form.setValue('hiddenVariable', 'order_guide');
    else
        g_form.setValue('hiddenVariable', 'standalone');

}

3) then you can use onLoad catalog client script which applies on "Catalog Task" and access the value of this variable by GlideAjax and determine if the RITM associated to this Catalog task was submitted as standalone or part of order guide

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader