Possible to set/update sys_created_on and sys_created_by fields of a table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2018 03:52 AM
Hi,
i'm trying to understand if it is possible to set/update sys_created_on and sys_created_by either via TableAPI or glideRecord?
I have two use cases. First, we plan to have an external API to do a non-SN authentication&authorization check and then use one service token to do API calls to SN to add entries to tables. But, the entries should be done "on behalf" of a user, therefore i have to set the sys_created_by to the user instead of the userid of the service token during the insert.
Second use case is to change the sys_created_by for some automated testing. i'm writing a query API and would like to update the time in some automated test cases also via API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2018 05:58 AM
Yes, we do have an option with autosysfield(false). Hopefully it is an inbound webservice and you will be creating a transform map for that particular table.
1. Create your Transform Map like normal with your source table, target table, and all of your fields mapped like normal.
2. Check the "Run business rules" box so that it remains unchecked.
3. Check the "Run script" box so that it remains checked.
4. In the script box make sure to add:
//Make sure update is only done on existing records
if ( action == "insert") {
ignore = true;
}
/* Disable SN from auto updating sys_fields*/
//Needed in order to leave historical information unchanged
target.autoSysFields(false);
//Disable the running of business rules that might normally be triggered by SN.
target.setWorkflow(false);
5. At the bottom left, in the Field Maps tab/list, create a new field map
Create a new mapping from your target import table to your sys_ field that you want to update
6. Save, upload your data, and run your transform.
