
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 04:14 PM - edited 06-04-2024 06:59 PM
Hello everyone,
I need to execute a script that inserts into the sys_user_grmember table. However, since the Application Administration is active, I need to run it with the admin user of the application. I tried running it via Scheduled Job with this user, and it worked well, but I can't seem to update the parameters.
PS: I am aware of SncTriggerSynchronizer but not sure how to pass the parameter.
Does anyone have any suggestions?
Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 05:07 PM
To solve my issue, I created a new role with the Application Administration field set to true and assigned this role to the user who needed to run the scripts. This allowed the script to be executed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 10:20 PM
I would recommend the use of a Script Action because it allows you to execute long running jobs in the background (longer that 5mins) and pass parameters to it.
- Create an event in the Event Registry.
- Create a Script Action. Notice here I am binding it to the event we created earlier.
- Execute the Script Action. For this example I am using a Fix Script, but you can use a Business Rule, Scheduled Job, another Script Action, etc...
- Here's the result:
Hope this inspires new ideas on what you can do.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 04:51 AM
Thanks for your input.
But in this case, the action will be executed by the system user, right? The issue in my case is that I need the action to be executed with a specific user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 05:45 AM - edited 06-05-2024 05:51 AM
You can leverage GlideImpersonate; documentation located here.
//pulled straight from the documentation
var user = gs.getUserDisplayName();
gs.print ("The current user display name is: " + user);
var impUser = new GlideImpersonate();
impUser.impersonate("62826bf03710200044e0bfc8bcbe5df1");
var user = gs.getUserDisplayName();
gs.print ("The impersonated user display name is: " + user);
I have leveraged GlideImpersonate on a few ServiceNow to JIRA integrations (bi-directional communication), where by a comment added to Jira would appear on the ServiceNow ticket as if the user commented on the ticket.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2024 12:51 AM
Hi,
What do you mean by not being able to update parameters?
Scheduled Jobs aren't intended to have values passed into them, they're intended to be self-invoking and fetch any information they require (potentially from a system property).