Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

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();  

Awesome, hopefully OP marks question answered if this solves for them.

chennessy
Kilo Expert

It worked!!!  Thank you, thank you, thank you!!!

I love the ServiceNow Community!