Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

What causes cross-scope errors in record producer?

k_47
Tera Contributor

I can't set a value for variables in the server script of Record producer.

 

The following script is included in the server script.

 

producer.u_record_producer_variable = value;
 
As a result, the following error was returned.
 

ErrorAccess to api 'put(sys_user.u_record_producer_variable)' from scope 'aaa' has been refused due to the api's cross-scope access policy.


aaa is the scope containing the record producer.

 

Do you know how to get rid of this error?

 

Thank you in advance.

7 REPLIES 7

Ankur Bawiskar
Tera Patron

@k_47 

you can't set producer variable from record producer script

why to have duplicate question in community?

you already raised one sometime back

Get the sys_id of the target record to set to the ... - ServiceNow Community

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Sorry. The title of the question was not good.

I wanted to ask about the cause of the error. 

@k_47 

you want to set record producer variable from record producer script?

if yes then not possible

You can use after insert BR and update the variable

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