Script Include not getting executed in "Data Table from Instance Definition" widget instance filter

Sachin Gavhane
Tera Guru

Hi Team,

I am working with the Data Table from Instance Definition widget in Service Portal.

In the Widget Instance configuration, I am trying to use a Script Include in the Filter field, as shown in the screenshot below.

SachinGavhane_1-1782569665671.png

 

 

Example:

Store is one of javascript:new global.MyHeroLetters().getStoresForCurrentUser();

However, the Script Include is never executed. I added gs.log() statements inside the method, but no logs are generated, indicating that the Script Include is not being invoked.

The Script Include is active and accessible, and the method returns a comma-separated list of sys_ids.

Could anyone clarify:

  • Does the Filter field of the Data Table from Instance Definition widget support javascript: expressions?
  • If not, what is the recommended approach for applying a dynamic filter based on the current user?

    Script Include is as follows:
    SachinGavhane_0-1782570204319.png

     

Any guidance would be appreciated.

Thank you!

 

 

 

 

4 REPLIES 4

Tanushree Maiti
Tera Patron

Hi @Sachin Gavhane 

 

Can you confirm whether your cloned/custom widget is triggering properly. 

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

yes, widget is triggering properly @Tanushree Maiti 

yashkamde
Mega Sage

Hello @Sachin Gavhane ,

 

can you confirm that the filter field can call script Includes ?

 

Because as far as I know the javascript: expressions in that filter field only work with client accessible objects like g_user.userID, g_user.name, etc. They cannot call Script Includes.

Neither I am sure whether filter can call script include @yashkamde 
Kindly help me with other approach incase if SI is not possible here in the filter

Thanks !