- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 01:15 AM
Hi friends,
Have a basic question. how to create records with system as the user name. There are few places where i need to create records with some common names ... but dont want any specific login name on Public UI pages...
can you please help me with an example if possible! thanks a lot;!!!!
Best Regards
Rahul N
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2017 03:40 PM
Hi Rahul,
If I understand your requirement, you need to override the created_by value with 'system' and other values like sys_created_on..etc to be kept as they come from the external system. Please correct me if I am wrong. This is not very ideal to do from the 'Audit' perspective. Technically you can achieve this using as shown below.
var gr = new GlideRecord('incident');
gr.addQuery('number', 'INC1234567');
gr.query();
if(gr.next()){
gr.sys_created_by = 'system';
gr.sys_created_on = inputDate;
gr.autoSysFields(false);
gr.update();
}
Hope this helps. Mark the answer as correct/helpful based on impact.
Thanks
Antin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 03:33 AM
when you create a scheduled job, you can define as to what user it should run as and also timezone, there if you set the user as 'system' you will see those records created by 'system'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 11:06 PM
Thanks for your reply Anaurag. But how can it be always schedule job.. sometimes, it will come from user in UI pages..etc.
how do we solve those scenarios ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 11:12 PM
What do you want to achieve? who cares with what account used record is created? If it is an integration then you can use an integration account. I do not understand your issue here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2017 11:58 PM
my requirement is to keep the same username as system, data...etc which comes from the other system... integration username is different. cant be used.. any other ideas anybody?
any help?