g_service_catalog.isOrderGuide doesn't work anymore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2020 03:28 AM
Hi everyone,
I am working on serveral Catalog Items and in one variable set I need to know if I'm in an order guide or standalone item.
I used the following code to determine that on Service Portal:
if (g_service_catalog.isOrderGuide)
{ // Do stuff if is in an order guide }
It returns always true. I checked using g_service_catalog.isOrderGuide(), since many examples I found used this code, but that one always returns false, wheither I'm in order guide or not.
I found that g_service_catalog.isOrderGuide returns the following sequence:
function(){ return formModel.isOrderGuideItem ? true : false; }
Shouldn't that be "resolved" and simply return true or false ?
Thanks in advance for anyone that could help me.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2020 01:14 AM
I found out that it returns always false in initial state of the form. Once on the Choose Options section, it works fine. The only thing is I want to know if it's an order guide at this point.
var isOrderGuide = g_service_catalog.isOrderGuide();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2021 01:00 PM
Anyone has an update an alternative to this. g_service_catalog.isOrderGuide() still returns a false response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2021 06:54 AM
Hi Tina,
I used this code as a workaround
// This method returns true if it's in an order guide, but not for the initial state of the form
if (g_service_catalog.isOrderGuide())
{
doInChooseOptions();
// If the sysId is the order guide for a new user
} else if (g_form.getSysId() == "a830cbff378c22004dc2d69543990e37")
{
doInDescribeNeeds();
} else {doElsewhere();}
That means that in the first condition, will be false if it's a new record, and true if it's in Choose Options section from an order guide.
If false, the second condition checks the sysId of the order guide. If it is the case, you're in the describe needs of the order guide.
Else, all other scenarios, displaying of an existing RITM, standalone item, etc...
Note that I have only one order guide, if several, you'll need to add as much checks as you have different order guides.
I also created a code that redirects to the same function weither you're on Catalog view or not, so in my functions I only have to do my code once.