The CreatorCon Call for Content is officially open! Get started here.

setWorkflow() cross-scope access issue

Robbie Lacivita
Tera Guru

I am unable to call setWorkflow() from a scoped application.

I've attached the code that I'm running, as well as an image of the cross-scope access policy and an excerpt from the log.

The ServiceNow documentation clearly states that setWorkflow should be callable from other application scopes. the cross-scope access was granted, however the logs still say that access to the api 'setWorkflow' from my application scope was refused due to the api's cross-scope access policy.

I am at a loss on how to solve this. Has anyone else experienced and solved this?

I had an idea to create a global script include to call setWorkflow, and call that function from my app scope, but it appears that it simply sets setWorkflow for any calls from the Global scope, and everything I'm doing from my app scope still triggers business rules to run.

Thanks,

Robbie

5 REPLIES 5

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

Lets take an example:

You have global scope and two scoped application.

If you do setWorkflow(false) in global scope it will only stop the business rule execution in that scope and not  in other two scoped application. Similarly if you do setWorkflow in one scope app it will only stop BR execution for BR related to that scope and not for global scope and other scope app.


Thanks,
Ashutosh

Ashutosh,

I figured that out when trying to initialize it in another method other than calling it directly in the script. The issue I'm having is calling it in the scoped app is being denied by cross-scope policy, even though its been granted access.

Or are you saying that I cannot call setWorkflow from my scoped app and have it not run business rules that are in another app scope? So for instance, if I have a global business rule and a scoped business rule on the incident table, calling setWorkflow from a scoped app will only turn off the scoped business rule? To me that seems like broken functionality, as the whole point of calling that would be to disable all business rules running on a table regardless of scope.

Thanks,

Robbie

Gilberto Silva
Tera Contributor

Hello Robbie,

Does the problem still persist for you?

 

If yes, how you did solve it?

VaranAwesomenow
Mega Sage

In order for a script to execute setworkflow false an entry has to be created in cross scoped access privilege table with source scope as scoped app -> scope of the table on which gliderecord query being executed.

target scope is global and script name will be SetWorkflow

 

VaranAwesomenow_0-1694404007316.png