My Requests widget and menu item for scoped app?

chennessy
Kilo Expert

Service Portal newbie, I am.  I'm attempting to use a Requests menu item in the header for a scoped app.  I pulled it from the SP_Header menu.    I was able to solve the issue of $sp not working in a scoped app (found some code online here that worked!)  but now I am getting an error message that getGlideObject() is not a scoped API. I saw one post that you have to use the scoped API GlideDate or GlideDateTime but I have no idea how to script it, or replace the existing line of code that contains getGlideObject().   Has anyone edited that script in the SP_Header menu for Requests to get it to work in a scoped app?  Same with the widget... no luck there either.   Thanks in advance!

 

 

1 ACCEPTED SOLUTION

I was able to resolve this by changing:

a.sortOrder = z.sys_created_on.getGlideObject().getNumericValue();

to:

var gdt = new GlideDateTime(a.sys_created_on);
a.sortOrder = gdt.getNumericValue();  

View solution in original post

7 REPLIES 7

chennessy
Kilo Expert

The title is someone misleading... not dealing with the my Requests widget... but the menu item.

 

Jace Benson
Mega Sage

Can you be more specific.  What did you try, how did it fail, what are you trying to accomplish?

I have a scoped app that I am building a Service Portal, "ITDAS". 

I created an ITD Header Menu based on the SP Header Menu (OOB).

I attempted to add the "Requests" Menu Item, based on the item of the same name in SP Header Menu. I copied the Server Script and Condition from that SP Header Menu Item "Requests".

When I attempt to load the page, the first error message was $sp not defined. I was able to substitute some code I found online that worked for that error  (shown in this snippet).

Now I am getting the error message: Function getGlideObject is not allowed in scope x_itdas.

Here is the snippet of code that contains getGlideObject

Thanks for looking at it!

find_real_file.png

 

 

I want the Requests item to appear in the header menu, with a drop-down view of that customer's requests.  (what I'm trying to accomplish).   Thanks again.