gs.executeNow returns null sys_id

Chrisdev
Kilo Expert

I have a scoped application which has a Scheduled Script Execution (sysauto_script) and an Import Set (scheduled_import_set). The Scheduled Script Execution's script performs some logic then calls gs.executeNow() on the application's Import Set record. The Scheduled Script Execution and Import Set are both part of the same scoped application (and have their sys_scope value set to the value of the scoped application).

The Run As user for my Scheduled Script Execution is a non-admin user, which has the appropriate roles to read/write to necessary tables.

However, gs.executeNow() always returns null (unless I run the Scheduled Script Execution as an admin), indicating to me that somehow the script/import_set are in different scopes?

The Scheduled Script Execution is being executed by clicking on the 'Execute Now' button in the UI. Interestingly when I Iog gs.getCurrentApplicationId() the current application is "global", even when the sys_scope is set to my custom application? 

Any idea why gs.executeNow() works (returns a non-null sys_id) with admin but not a non-admin with appropriate read write roles to the tables I require access to?

5 REPLIES 5

Chrisdev
Kilo Expert

I think the ACL route is along the correct lines. I've managed to get this working with a GlideRecordSecure if I view the Application (sys_app) > Manage Developers > Add user with "Integrations" file type access. Looking at the docs this "Grants the assigned developer access to web service APIs, REST APIs, and data sources."

I can see the user is automatically given a "delegated_developer" role and "sn_dd_xxx_integrations" auto generated role. Not sure how to replicate this access by manually creating permissions. Ive tried various ACLs/roles associated with the scheduled_import_set table.

Will update again once I find something that works.