set user as litigation hold true

Brian S5
Kilo Sage

I have a requirement to set users as on "Litigation Hold".

I have added a Litigation check box to the user form.

find_real_file.png

I have also configured sweet alerts to pop up when the caller_id is on litigation hold. This way when an incident is opened and the caller that is set is on Litigation hold it pops up a message and another client script to set the message under the caller_id field  

find_real_file.png

find_real_file.png

This pop up works when the customer is set as a Litigation user.

The users in our company that are on litigation hold is specified in the description field in AD. That description maps to the description in the user form in SN via an ldap transform.

There are about 1300 users in our organization that are on litigation hold, so i need assistance trying to set the checkbox as true via a background script, or a client script or business rule. (whichever way is easier, im not sure) based on the description field containing "Litigation hold"

Does anyone know of the best way to do this via some script ?

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Here is your BG script. You can also write fix scripts for this. Before running this copy the following script in the background scripts and see the number you get on the console. This is the total number of records that contains description as litigation hold. If it is working as expected then go ahead with the second script


script 1:


Var gr= new GlideRecord("sys_user");


gr.addQuery('<field name of description>','CONTAINS',"Litigation hold");


gr.query();


gs.print(gr.getRowCount());



Script 2:


Var gr= new GlideRecord("sys_user");


gr.addQuery('<filed name of description>','CONTAINS',"Litigation hold");


gr.query();


while(gr.next()){


gr.<litigation hold field name>=true;


gr.update();


}


View solution in original post

3 REPLIES 3

Abhinay Erra
Giga Sage

Here is your BG script. You can also write fix scripts for this. Before running this copy the following script in the background scripts and see the number you get on the console. This is the total number of records that contains description as litigation hold. If it is working as expected then go ahead with the second script


script 1:


Var gr= new GlideRecord("sys_user");


gr.addQuery('<field name of description>','CONTAINS',"Litigation hold");


gr.query();


gs.print(gr.getRowCount());



Script 2:


Var gr= new GlideRecord("sys_user");


gr.addQuery('<filed name of description>','CONTAINS',"Litigation hold");


gr.query();


while(gr.next()){


gr.<litigation hold field name>=true;


gr.update();


}


Thank you. It is working exactly how I needed it with your help. The script worked flawlessly, thank you.



Var gr= new GlideRecord("sys_user");


gr.addQuery('u_description','CONTAINS',"Litigation hold");


gr.query();


gs.print(gr.getRowCount());



Var gr= new GlideRecord("sys_user");


gr.addQuery('u_description','CONTAINS',"Litigation hold");


gr.query();


while(gr.next()){


gr.u_litigation=true;


gr.update();


}


Glad I could help