Browser console generates warning message: "Cannot read properties of undefined (reading 'execute')

Aamir1Khan
Tera Contributor

Hi,

 

On Service Portal, UI policy does not work and when checking the browser console there is an error "Could not load U IPolicy script for policy" and there is error "There is a JavaScript error in your browser console" error message appears when accessing the Service Portal form."

 

I found it is a known error, but even after trying the resolution it is not working. 

Link - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0755827

 

This is the script that I am using in my UI Policy "Execute if true" section :-

 

function onCondition() {
    g_form.clearOptions('request_reason');
    g_form.addOption('request_reason','','-- None --');
    g_form.addOption('request_reason','ltds','LTDS');
    g_form.addOption('request_reason','week_24_28','Week 24(28)');
    g_form.addOption('request_reason','income_management','Income Management');
}
 
Please help me how can I remove this error.
 
Thanks and regards,
Amir
 
 
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Aamir1Khan 

why not use client script for scripting?

UI policies are mostly used when the logic is simple

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

View solution in original post

3 REPLIES 3

Aamir1Khan
Tera Contributor

@Ankur Bawiskar It would be great if you can help.

Thanks

Ankur Bawiskar
Tera Patron
Tera Patron

@Aamir1Khan 

why not use client script for scripting?

UI policies are mostly used when the logic is simple

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

Hi @Ankur Bawiskar ,

 

I have use client script and now it is working. Thankyou . 

 

Regard,

Amir