How to use autosysfields(false)

Santhosh23
Tera Expert

How to use autosysfields(false) for the records updating via glidesysattachment.copy method.

6 REPLIES 6

Harshal Gawali
Giga Guru

Hello Santosh,

autosysfields() is a method of GlideRecord API. It is used if you don't want to update system fields like(created, created by, updated, updated by, updates, sys id) through scripting, then you can make autosysfields(false).

By default system fields are read-only so you cannot make any changes on form and list view. ServiceNow already written OOTB ACL on it. But through scripting you can change value in it. So to avoid changes from scripting on system fields, you can use autosysfields(false) method.

 

Regards,

Harshal.

Kartikay Nigam
Tera Contributor

I am using this script to update a short description for an incident, it does the job of not updating the updated by field when I see it in listed view, but when I go for incident history it shows my name. Why is that so?

 

var a = new GlideRecord('incident');
a.query();
while(a.next()){
    if(a.number == 'INC0010007'){
        a.autoSysFields(false);
        a.short_description = 'Test-3';
        a.update();
    }
}
I ran this script as sys admin, you can see the updated by is not updated in listed view however the 2nd SS says I have updated it.