The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to trigger workflow with instance-specific "Run As" users from a scoped app?

AneeshPa1
Tera Contributor

I have a scoped application and need to trigger a workflow to run as different users, depending on the instance (e.g., dev, test, beta, prod). My initial approach was to create a Scheduled Job that impersonates the desired user based on the instance name and then starts the workflow. However, I learned that impersonation functions like gs.getSession().impersonate() or GlideImpersonate() are not allowed in scoped applications due to security restrictions.

 

I also don't have access to set the "Run As" field directly in the Scheduled Job configuration.

 

Has anyone faced a similar situation and found a workaround to trigger a workflow from a Scheduled Job within a scoped application, dynamically changing the execution user based on the instance?

1 REPLY 1

Sandeep Rajput
Tera Patron
Tera Patron

@AneeshPa1 Try creating a script include in global scope with a method which triggers your flow. This method will also contain your line of code for impersonation.