The CreatorCon Call for Content is officially open! Get started here.

How to use UI Scripts in Workspace?

friedrichmue
Tera Contributor

Hello,

 

what is best practise for using UI Script in Workspace as well as in the Calssic UI?

In article How to convert UI Scripts to run in Configurable Workspaces - The SN Nerd

the g_ui_scripts API is used to load the UI Scripts. That requires changes in Client Scripts and UI Scripts. 

Is there any way to use UI Scripts in Workspaces without changing Client Scripts and UI Scripts?

(e.g. In the Service Portal it´s possbile to add UI Scripts to a sp_theme)

 

Best Regards

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@friedrichmue 

that's what UI scripts do.

UI scripts are meant to be called from client scripts or UI policies which run at client side.

UI scripts are not called from server side.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

yes, but if you want to call a UI Script from a Client Script in a Workspace, you need to load it with the g_ui_scripts API. That requires code adjustments in both, the Client Script and the UI Script.

E.g. in the Project Workspace you can view Project related records like pm_project or pm_project_task.

Existing Client Scripts on that tables can not load UI Scripts without adaptions.

friedrichmue
Tera Contributor

@Ankur Bawiskar 

Yes, but that question was about the usage of UI Scripts in a Workspace.