Update manage document owner by batch

yandp
Tera Guru

Hello all, 

I have many manage document need to update, is there a way to update by batch ?

below are the field need to update:

1. update document owner- as the original user resigned

2. set manage document permission by batch instead one by one

 

Please share with me, if you have any idea or did it before.

Thank you so much.

1 REPLY 1

Its_Azar
Kilo Sage
Kilo Sage

Hi there @yandp 

 

You can update managed documents in batches using a script.

first update document owner

var newOwner = 'sys_id_of_new_owner';
var gr = new GlideRecord('managed_document_table');
gr.addQuery('document_owner', 'sys_id_of_resigned_owner');
gr.query();
while (gr.next()) {
    gr.document_owner = newOwner;
    gr.update();
}

 

Set permissions

var newPermission = 'new_permission_value';
var gr = new GlideRecord('managed_document_table');
gr.addQuery('some_condition', 'value');
gr.query();
while (gr.next()) {
    gr.document_permission = newPermission;
    gr.update();
}

 

 

If this helps kindly accept the response thanks much.

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.

Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG