- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 04:00 AM
Hi Everyone,
The 'Created by' field on the target table is updating as a 'system' by default from transform map.
I am unable to modify it to my required user account by using field map script/transform script/run script.
Could anybody please help me to resolve this?
sample code I used:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
target.sys_created_by = "abc.xyz";
target.sys_updated_by = "abc.xyz";
})(source, map, log, target);
Thanks & Regards
Ranjita Hegde
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 04:44 AM
Hi,
You can achieve that by adding one line in your code just before you are trying to set Created BY and Updated by as below:
target.autoSysFields(false);
target.sys_created_by = "abc.xyz";
target.sys_updated_by = "abc.xyz";
However it is not a good practice to override System generated fields. Refer the HI Article from HI on the same topic:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0859763
Go through it nd then take your decision.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 04:12 AM
Hello,
The created by and Updated by field tasks the name of the user who actually runs the activity. So if you are manually running the transform script it should by default take your name unless you have used the below somewhere
autoSysFields(false);
Please mark answer correct/helpful based on impact.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 04:14 AM
Do you need the value to change per row, or do you just want to set it to something other than system?
One option is to create a scheduled import and set the "run as" field. You can then use the execute now UI Action. This'll run the import as that user, rather than system
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 04:24 AM
Hi,
Thanks for the Reply.
I am using 'script action' to create the import set. Not using scheduled import. So in this case, cant we use field map script/transform script/run script?
Thanks & Regards,
Ranjita Hegde
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 04:44 AM
Hi,
You can achieve that by adding one line in your code just before you are trying to set Created BY and Updated by as below:
target.autoSysFields(false);
target.sys_created_by = "abc.xyz";
target.sys_updated_by = "abc.xyz";
However it is not a good practice to override System generated fields. Refer the HI Article from HI on the same topic:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0859763
Go through it nd then take your decision.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke