Flow action : Error

Jonnie_
Tera Contributor

Flow action is executing successfully and runtime values are also coming correctly but getting the error at last.

 

 

Error Message:

The requested flow operation was prohibited by security rules.
 How to overcome this?
Jonnie__0-1673286209361.png

I am calling the flow action from script using //var result = sn_fd.FlowAPI.executeAction('global.attach',inputs);

Note - it works fine when i test the action manually.

 

1 ACCEPTED SOLUTION

Kartik Choudha1
Tera Guru

Hey Jonnie,

 

This error generally comes when a 'RUN AS' user mentioned doesn't have expected roles and privileges.

 

As you mentioned, When you test it manually, it works fine. The reason might be that you are logged in as Administrator and you have admin role.

But when the 'Action' gets executed from script, the action might get executed by 'Run as' some user and that user doesn't have privileges.

 

To check this -> Go to 'Executions' tab -> filter the logs for your action -> check 'created by' fields value.

The manually tested action log will be shown as 'admin'.

 

To resolve the issue, you need to assign roles to user and to just verify it pls try assigning admin role and test. It would work.

 

Hope this helps!

Regards,

Kartik

View solution in original post

4 REPLIES 4

Sagar Pagar
Tera Patron

Hi @Jonnie_,

Change Run as user to System user and try it.

 

Thanks,
Sagar Pagar

The world works with ServiceNow

Hey sagar,

 

Its a flow action and I am calling it directly from the transform script using below statement.

var result = sn_fd.FlowAPI.getRunner().action('global.attach').inForeground().withInputs(inputs).run();

 

I am not able to see any 'run as' option.

Kartik Choudha1
Tera Guru

Hey Jonnie,

 

This error generally comes when a 'RUN AS' user mentioned doesn't have expected roles and privileges.

 

As you mentioned, When you test it manually, it works fine. The reason might be that you are logged in as Administrator and you have admin role.

But when the 'Action' gets executed from script, the action might get executed by 'Run as' some user and that user doesn't have privileges.

 

To check this -> Go to 'Executions' tab -> filter the logs for your action -> check 'created by' fields value.

The manually tested action log will be shown as 'admin'.

 

To resolve the issue, you need to assign roles to user and to just verify it pls try assigning admin role and test. It would work.

 

Hope this helps!

Regards,

Kartik

Hi

 

I tried this and it is correct.

 

But Could you let me know which role a user should have? After assigning admin role it works fine but I don't want to have admin role for that user. @Sagar Pagar @Kartik Choudha1