Insert a record in table through script and set 'created by' to service account
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2023 12:50 AM
We need to insert a record in a table through a workflow. While using Glide Record, the record is getting inserted, but the 'created by' field is getting set to the person triggering the workflow. We need to set the 'created by' field as a service account. Please let us know in case if there is any way to set the 'created by' field through the script from the workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2023 12:54 AM
Hello @kalpesh9
A simple way to achieve this is by scheduled job.
Setup a scheduled job, to run the script for inserting the record.
Now in the scheduled job, you have a field called Run As.
In the Run As field, you can set the value as the service account.
So whenever, the record is created, it shows created by as the service account
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2023 12:55 AM - edited ‎02-23-2023 12:55 AM
Hi @kalpesh9,
You have to use the timer activity with 3 seconds time in it. It will switch the User context to System context.
After that use run script activity -
grObject.sys_created_by = "service_account";
grObject.setWorkflow(false);
grObject.autoSysField(false);
grObject.insert();
Thanks,
Sagar Pagar