How to trigger workflow with instance-specific "Run As" users from a scoped app?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2025 08:22 PM - edited ‎02-20-2025 08:26 PM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2025 07:54 AM
@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.