A Service Portal widget is not rendering on the page, and the browser console shows: 'Uncaught ReferenceError: sp is not defined'. The widget's client script uses 'sp.get()'. What is the cause?
In Service Portal, client controllers must list 'sp' as a dependency to use the sp API.
Why this answer
The user sees an error 'sp is not defined' because the client script uses 'sp.get()' but 'sp' is not available. In Service Portal, the 'sp' API must be explicitly injected into the widget's client controller. If it is not listed in the dependencies of the client controller function, the script will not have access to 'sp'.
Therefore, Option B is correct. Option A is incorrect because the order of widgets on the page does not affect dependency injection for individual widgets. Option C is incorrect because 'angular' is not required for 'sp'; it is the Service Portal API that needs to be injected.
Option D is incorrect because there is no race condition; the server script runs first and does not affect the client-side dependency injection.