How to fix error "Could not load UIPolicy script"?

peterraeves
Mega Guru

I created a very basic UI Policy script for testing purposes and received the following error "Could not load UIPolicy script". What is going on and how can I fix this?

This is the UI Policy

Image 1.png

I put the UI Policy to run on the portal (or 'All')

Image 2.png

When I open the record producer on the service portal, I receive the following errors

Image 3.png

1 ACCEPTED SOLUTION

Then this goes to ServiceNow support.


View solution in original post

10 REPLIES 10

alexaria
Tera Contributor

This is how I fixed the error (very strange and random):

- comment all your code in the UI Policy except Alert() then save and refresh/hard reload the page.

-- You should see the alert but no errors.

- uncomment your code line by line, save, and reload the page.

-- no error you should see until a specific line, then try a different approach for that line, save, and reload the page.

- continue the same until all your ui policy code is error-free.

This worked for me good luck.