Access to api 'setWorkflow' from a custom scope

Andrew Pishchul
Giga Expert

I have a simple task but feel like I'm hitting a wall. I need to call setWorkflow on a basic table (e.g. 'task' table) from a scoped application:

var gr = new GlideRecord("task"); 
gr.setWorkflow(false);

I know that cross-scope privileges required, so I created multiple (I'm just desperate to get it work):

find_real_file.png

And it still doesn't work. When I run those 2 lines of code in a script-background in a context of my scoped app, I get a message:

Security restricted: Access to api 'setWorkflow' from scope '----' has been refused due to the api's cross-scope access policy

Is that something missing in cross-scope privileges?

4 REPLIES 4

prasanna11
Mega Guru

Hey , 

 

Did you try checking your app's access in "sys_scope_privilege" table. 

You can read about the working of it here 

https://docs.servicenow.com/bundle/jakarta-application-development/page/build/applications/reference...

 

Please Mark Helpful / Correct answer accordingly if it is.

Thanks,

Prasanna

 

Chandu Telu
Tera Guru
Tera Guru

HI hchulin

Please check the below link it may help you

https://community.servicenow.com/community?id=community_question&sys_id=db10d3e5dbdcdbc01dcaf3231f9619b6

Andrew Pishchul
Giga Expert

I have to say that most likely it's just not possible to call setWorkflow on out-of-the-scope tables. Within the scope, it works just fine.

ceskie
Kilo Guru

I ran into the similar issue. I have created cross scope access for setWorkflow, from my own scope to Global:

  • I can call setWorkflow from my own scope, on my own scope tables
  • I cannot call setWorkflow from my own scope, on tables in different scopes