{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":42628,"path":"platform-user-interface/service-portal/widget-dependencies.md","title":"Create a widget dependency","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a widget dependency\n\nIn Service Portal, you can link JavaScript and CSS files to widgets to create dependencies between widgets and third-party libraries, external style sheets, and angular modules.\n\n## Before you begin\n\nRole required: sp\\_admin or admin\n\n## About this task\n\nDependencies are loaded asynchronously from the server when needed.\n\nWidgets can have as many or as few dependencies as needed. However, the more you add, the more content a widget must download to render on the page. Keep dependencies as small as possible for more efficient load times.\n\n## Procedure\n\n1.  Create a dependency package.\n\n    A dependency package is a collection of JavaScript and CSS files that can be connected to a widget.\n\n    1.  Navigate to **Service Portal** &gt; **Dependencies**.\n\n    2.  In the dependency record, define the following fields.\n\n        |Field|Description|\n        |-----|-----------|\n        |Name|The name of your dependency. \\(Useful for selecting a dependency from a dropdown list.\\)|\n        |Application|Application scope for the dependency record.|\n        |Include on page load|Select if you want your dependency to be loaded onto the page on the initial page load of Service Portal, or leave unchecked to load the dependency only when the linked widget is loaded onto a page.|\n        |Angular module name|Optional. Define the value if the linked JavaScript is an Angular module. Provide the name of the Angular module being loaded, so that it can be injected into the Service Portal Angular application.|\n\n2.  Add files to the dependency package.\n\n    After you save the information for your dependency package, use the related lists to add JS and CSS Include files. For each related list, include the following information:\n\n<table id=\"table_sjx_vgl_3w\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nDisplay name\n\n</td><td>\n\nName of the script include.\n\n</td></tr><tr><td>\n\nSource\n\n</td><td>\n\nDepending on whether you add a JS Include or a CSS Include, select one of these options from the list:-   URL\n-   UI script \\(for a JS Include\\) or Style Sheet \\(for a CSS Include\\)\n For a JS Include, use the UI Script field to reference a UI Script found in **System UI** &gt; **UI Scripts**.\n\n For the CSS Include, use the Style Sheet field to reference a record in the `sp_css` table.\n\n</td></tr></tbody>\n</table>3.  Add a dependency package to a widget.\n\n    After you have created a dependency package and added files, create a relationship between the dependency and a widget.\n\n    1.  Navigate to **Service Portal** &gt; **Widgets** and find the widget record you want to add the dependency to.\n\n    2.  From the Dependencies related list, click **Edit**.\n\n    3.  In the slushbucket, find the dependency you created and double-click to add it to the selected items column on the right.\n\n    4.  Save the page to return to the widget record.\n\n\n-   **[Include a font icon in a single widget](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-user-interface/service-portal/include-widget-icon.md)**  \nIf you only want one widget to have access to a font icon, include the font icon in a single widget.\n-   **[Include font icons as a widget dependency](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-user-interface/service-portal/font-icons-dependency.md)**  \nYou can include font icons wherever a widget is loaded by including them as a widget dependency.\n\n**Parent Topic:**[Developing custom widgets](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-user-interface/service-portal/widget-dev-guide.md)\n\n"}}