Business rule to deactivate the user when user profile deactivated into user table

BanuMahalakshmi
Tera Contributor

Hi,

 

Assigned to field is list collector data type. when active value changes into false into sys_user table, the value should deactivate into assigned_to field also(cmdb_Ci table). I have tried the below script but it removed all assigned_to field value. pls let me know the changes in the script. Thanks.

 

BanuMahalakshmi_0-1721809357691.png

 

 

  var assignee = new GlideRecord('cmdb_ci');
    assignee .addQuery("assigned_to", '=', current.sys_id.toString());
    assignee .query();
    while (assignee .next()) {
        assignee .assigned_to = "";
        assignee .update();
    }
1 REPLY 1

Mark Manders
Mega Patron

Please check on the duplicate question you asked: https://www.servicenow.com/community/developer-forum/deactivate-user/td-p/2998014

 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark