Updating existing HR Profiles to match updated Client Role Assignment Rules

Mark Small
Tera Expert

In HRSD, we us Client Role Assignment Rules to apply particular roles to the user profile.    There is a Business Rule (Assign HR Roles) that runs when HR profiles are updated to add or remove those roles based on the Assignment Rules.

 

We recently updated the Client Role Assignment Rules, and now need to apply those rules to all existing HR profiles to make sure they have the appropriate roles based on the updated rules.  The Business Rules is only triggered if the HR profile is changed.   How do we get the new rules to apply to all existing HR profiles?   Is that a script that needs to be run against HR profiles?

 

Thanks for any help or insight you can provide!

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Mark Small run a simple fix script to update any field on the HR Profiles and your business rule (Assign HR Roles) will trigger.

 

Here is how you can configure the fix script.

Screenshot 2023-04-26 at 11.20.09 PM.png

Here is the script.

var hrProfile = new GlideRecord('sn_hr_core_profile');
hrProfile.query();
while(hrProfile.next()){
    hrProfile.sys_updated_on = new GlideDateTime();
    hrProfile.update();
}

This script is just updating the sys_updated_on field on the profile.

 

Hope this helps.

View solution in original post

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@Mark Small run a simple fix script to update any field on the HR Profiles and your business rule (Assign HR Roles) will trigger.

 

Here is how you can configure the fix script.

Screenshot 2023-04-26 at 11.20.09 PM.png

Here is the script.

var hrProfile = new GlideRecord('sn_hr_core_profile');
hrProfile.query();
while(hrProfile.next()){
    hrProfile.sys_updated_on = new GlideDateTime();
    hrProfile.update();
}

This script is just updating the sys_updated_on field on the profile.

 

Hope this helps.

Mark Small
Tera Expert

Thanks, I should have been more clear.  The filter conditions on the Business Rule are if specific fields are changed, i.e. Employment Start Date, Employment End Date, Employment Type, etc.   Would the Fix Script need to force those fields to change in order for the roles to be added or removed?  Assign HR Roles _ Default Filter Conditions.PNG

@Mark Small Yes, if the Assign HR Roles business rule has condition defined on it then the fix script needs to update one of those fields to make it run. 

 

Alternatively, you can add one more condition Updated on changes in this BR and run our fix script, this will enable the BR to run for all the HR profiles. Afterwards, you can restore the filter conditions back to previous version by removed Updated on changes condition