sys_trigger record creating by system user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi All,
i want to run a job in batches for which i am using scheduled job script . This script is creating five sys_trigger entry which are 1hr time distance with required batch data.
But here i am getting issue ..when sys_trigger run it is calling a script include which adding record to multiple table after applying the transformation logic . I want these record to insert with specific user but as currently they are inserting as created by "system" user.
Although the user is set for "Run as' column of main scheduled job.
can anyone help me to get the desire result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
can you share the current script which you are using to create 5 trigger?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
@MamtaNegi , You can configure the “Run as” field on the Scheduled Job form to control which user executes the job. However, only a single user can be selected there; and that’s also the recommended approach.
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
the Run As user simply controls the permissions for running the job.
It does not pass the user context for record creation inside scripts, and this is why you’re seeing "Created by: System" for inserted record
you will have to use custom logic to update the sys_created_by and sys_updated_by field with your user.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader