Bulk changing attestation respondents

LJ3
Kilo Expert

When staff leave, how can we bulk change the respondents on the attestations assigned to them?

I tried using the below script, but it does nothing unfortunately (even though it gives me a long list of re-assigned, it doesn't actually reassign):

var actualRespondentsSysID = '(currentusersys_id)';
var newRespondentsSysID = 'newusersys_id';
var gr = new GlideRecord('sn_compliance_control');
gr.addQuery('Respondents', actualRespondentsSysID);
gr.addQuery('state!=retired');
gr.query();
while (gr.next()) {
gr.Respondents = newRespondentsSysID;
gs.info('Control Attestation ' + gr.number + ' re-assigned');
gr.setWorkflow(false); // Optional: Do not run any other business rules (can only be executed in Global scope)
gr.update();
}

I can export the xml and replace the <respondents>SYID</respondents> then re-import, I've tested this but this isn't ideal if a user leaves who is the owner and attestation respondent to a lot of controls...

 

1 ACCEPTED SOLUTION

jing3
Mega Guru

The proper step is to cancel any existing attestations and recreate them with the correct respondents (using out of box processes). Assuming that the Attestation respondents is the Profile Owner (Entity Owner), and thus the Control Owner, use the following steps:

1. find the Profile (Entity) this person own, uncheck "active", then "update", this will retire all related records (include cancel all outstanding Attestations)

2. Change the owner of the Profile (Entity)  to the right person,  check "active" again, update, this will set Contorl(s) in "draft" mode

3. bulk change the owner of the control(s) to the right owner

4. bulk change the control(s) status to "Attest", new Attestations will be created. 

 

 

View solution in original post

17 REPLIES 17

Dexter Parre_o
ServiceNow Employee
ServiceNow Employee

Jing is right. What he mentioned is the correct process when the attestation assignees need to be changed. You don't go into the attestation and change the Assigned To. You cancel it, set the correct profile owner (assuming this is where the attestation respondents are taken from), then put the controls back to Assess state. You can manage these bulk changes easier by creating list choices UI action in list view so that you don't have to go through each record separately.

Prateek kumar
Mega Sage

You have to update this gr.Respondents = newRespondentsSysID; to the correct field name

Respondents doesn't look right. may be it is respondents ?


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

marknyquist
Tera Expert

I've had luck with the following:

 

find_real_file.png

Community Alums
Not applicable

This script will only update the respondents but you are forgetting to cancel their attestations as well. The easiest way is to move the attestation to draft and attest again. 

Community Alums
Not applicable

Agree with jing, best practise should be to return control back to draft and re-attest with correct respondents. If you mark an entity as inactive, all risks all controls and respective attestations will be retired or cancelled because it works in cascade. (retire a risk or control and all attestations will be cancelled).

If you want to do it manually, you can inactive a profile and all controls/risks and respective attestations will be cancelled. I've tested and it works. If you want to check the code behind of this popup, check the link https://instance.service-now.com/sn_grc.DeleteDialogBox.jsdbx on your instance. 

find_real_file.png