Mandatory false not set on field vendor: cross-scope access denied

Tadz
Tera Guru
Tera Guru

Hi,

I'm encountering this issue "Mandatory false not set on field vendor: cross-scope access denied"

I have created a scope app table that extends to application table where i'm making use of the vendor field.

But when i try to make the field mandatory false the error message shows in the logs "Mandatory false not set on field vendor: cross-scope access denied".

 

What kind of cross scope access do we need for this one?

 

Thanks,

Tads

1 ACCEPTED SOLUTION

Tadz
Tera Guru
Tera Guru

Hi Everyone,

It seems this is an existing problem in ServiceNow

Please see related Now Support Article:

Client scripts on a scoped table in cmdb hierarchy with g_form methods like "setMandatory, setDispla...

 

Description

Error "cross-scope access denied" thrown from scoped client scripts using g_form methods on global TPP fields.

Steps to Reproduce

 

1. Create a new or open an existing scoped application in Studio
2. Create a new scoped table extending cmdb_ci
3. Add an on-load client script as below on the scoped table to set a global field like "install_status" as Mandatory or read only, etc.

function onLoad() {
g_form.setMandatory('install_status', false);
g_form.setDisplay('install_status',true);
g_form.setReadOnly('install_status', false);
g_form.setDisabled('install_status', false);
}

4. Navigate to the list view of the table from step 2 and click New.

Result: The script does not work and below messages are seen in the console when the form loads

Mandatory false not set on field install_status: cross-scope access denied.
Display true not set on field install_status: cross-scope access denied.
ReadOnly false not set on field install_status: cross-scope access denied.
Disabled false not set on field install_status: cross-scope access denied.

Workaround

Use UI Policy and add a UI Policy Action to perform similar actions on the field.


Related Problem: PRB1384434

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

trying to make mandatory using UI policy?

Are you sure the filed is in same scope?

Regards
Ankur

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

@Tadz 

Would you like to share any update on this?

Regards
Ankur

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

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Is extended table in same scope as your custom table ? if not then you have to define cross scope privilages so that once you validate this through code you won't see such errors.

https://docs.servicenow.com/en-US/bundle/sandiego-application-development/page/build/applications/reference/c_CrossScopePrivilegeRecord.html

https://docs.servicenow.com/en-US/bundle/sandiego-application-development/page/build/applications/concept/restricted-caller-access-privilege.html

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Aman Kumar S
Kilo Patron

How are you setting the mandatory field, is it UI policy or client script?

Is it within same scope or different scope?

If from a different scope, that's why error would be coming, try to create config within the same scope as the table, if not possible, then enable cross scope development on the table.

Configure table > Application access > Allow configuration as True

find_real_file.png

Best Regards
Aman Kumar