Errors due to the api's cross-scope access policy

Riro1
Kilo Contributor

Hello! I tried running this code and got these errors. I tried to find a problem here but couldn't fix it so I guess I have no choice but to asks for the experts here:

THE CODE:

var gr = new GlideRecord('sys_transform_entry');
gr.initialize();
gr.source_table = "x_621597_service_o_service_one_import";
gr.target_table = "x_621597_service_o_service_one";

gr.source_field = "bill_add";
gr.target_field = "billing_address";
gr.map = "d53664c787a3011032bfcaaf8bbb3567";
gr.insert();

THE ERROR:

Security restricted: Access to api 'put(sys_transform_entry.source_table)' from scope 'x_621597_service_o' has been refused due to the api's cross-scope access policy
Security restricted: Access to api 'put(sys_transform_entry.target_table)' from scope 'x_621597_service_o' has been refused due to the api's cross-scope access policy
Security restricted: Access to api 'put(sys_transform_entry.source_field)' from scope 'x_621597_service_o' has been refused due to the api's cross-scope access policy
Security restricted: Access to api 'put(sys_transform_entry.target_field)' from scope 'x_621597_service_o' has been refused due to the api's cross-scope access policy
Security restricted: Access to api 'put(sys_transform_entry.map)' from scope 'x_621597_service_o' has been refused due to the api's cross-scope access policy
Security restricted: Create operation against 'sys_transform_entry' from scope 'x_621597_service_o' has been refused due to the table's cross-scope access policy

THE SITUATION:

I run it in global and there was no problem but I need to put this code in the scoped application and obviously, it got an issue with the cross-scope access policy. 

Anyone can help me with this?

28 REPLIES 28

I am using OOB table i.e "sc_request".And we need to enable that option.Without It we cant proceed further.

Thanks for You clarification.

Regards,
Anuja Jadhav

Carlos de la F1
Tera Contributor

Hi,

If you still experience cross-scope issues even after creating the cross-scope rules and activating the "application access" permissions in the table settings, try to refresh the cache by executing the below command in the "background - scripts" module:

gs.invalidateCache();

It was the only thing that worked for me.

Further reference in the below link:

Unexpected cross-scope error despite creating cross-scope privilege records

Please, Feel free to mark my answer as helpful if applicable.

Thank you!
Best Regards

Carlos DLF

Nicola Attico
ServiceNow Employee
ServiceNow Employee

Hi,

You have to run 

gs.invalidateCache();

Please see here: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0855735

Thanks,

Nicola

 

DeuCh44-ext
Tera Contributor

I know this is an old thread, but maybe it helps someone, who has the same problem as we had.
We simply forgot to add the variable set to the record producers script, where the definition takes place. 

Example line from record producers script:

producer.variable_set_name.opened_for = current.opened_for;

The opened_for after the variable_set_name is a variable in the variable set.