Search Widget: Scoped Application

Nikita28
Mega Guru

Hi All,

 

I am building Service Portal in the scoped application and cloned typeahead search widget along with all dependency scripts. However, I am facing the below issue.

Server JavaScript error Cannot find function getSearchSources in object com.glide.service_portal.widget.fencing.ScopedSPScriptable@dcaa96.

I search for an alternative method of getSearchSources() in Scoped application, but I didn't get anything.

Search Suggestion is also not working.

Is there any other approach to set a custom search in the service portal?

Any help would be appreciated.

Thanks in advance!

1 ACCEPTED SOLUTION

Okay,

The server script section needs to be modified. Couple of things you will have to think about... There are several global libraries used in the server script section of the widget, that may or not be accessible in scoped apps. So be prepared for the possibility this may not work at all.

You have to see if scoped apps allow you to access APIs like gs.hasRightsTo (looks like it doesn't allow it), GlideTableDescriptor, and GlideDBObjectManager to start with (there may be more, but saw those at a glance).

I don't think you will be able to get access to those APIs in scope but try. Your system logs may have some server side errors/warnings indicating issues on the server script that you can troubleshoot.

BTW, I have had to clone the form widget before, and it worked fine, but I did it in Global scope. If you aren't planning to put this app on the store, you can also just clone the widget in global scope, but use it in your scoped app on a page. I have done that before successfully.

View solution in original post

12 REPLIES 12

Hi Nikita,
Could you share how did you make the widget work in your scope application despite being in a global scope? what changes did you make?

Harsh Vardhan
Giga Patron

try to move the widget in global scope. getSearchSources () has not documented . i think this will only work in global scope.

Lewis Chi
ServiceNow Employee
ServiceNow Employee

We don't have any official documentation around API's such as “GlideTableDescriptor” and “FilteredGlideRecord”.

If it is not on https://developer.servicenow.com/, then it is very likely unsupported.

Also, the API might work in global scope, but there is a restriction at the java layer so there IS NOT a way around it. 

 

Thanks,

- Lewis Chi

ServiceNow Engineer