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

I added the "scope" keyword as you mention. But, it's now giving another error as below at line 19 as per your SS:

"Server JavaScript error The undefined value has no properties."

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.

Because we wanted to keep everything in the scope of our application as per the requirement.

 

I think getSearchSources() method is not available for the scope.

Do you know another way to create a search widget in scope application?

 

For now, I have been told to follow the cloned typeahead-search widget in global scope and use in our scope application.

As you said, there wasn't any issue as you have work on the global widget in scope application.

As you recommend I did try, and yes, it is working fine.

If they ask to keep the search widget in Scope application, then for sure I will reach out to you for some help.

Thank you!

Have a nice day!

 

Ya sure, So now it's working fine. 

Please Hit like, Helpful or Correct depending on the impact of the response if this solves your query!!

Thanks,

PKG