Effective with the release of Resource Hero v10.1, the legacy RHA Skills app will be retired.
Existing customers who have installed and are using the RHA Skills extension app should migrate to the native functionality as soon as possible.
As each customer situation (data volume, Salesforce edition, etc) is unique, we suggest you contact us so that we can discuss and assist with the migration.
Customers who plan on completing the migration on their own may find the following Apex Classes helpful as a starting point:
Migrator Class
public with sharing class Migrator {
public static void migrateSkills() {
//Migrate skills
List<RHA_Skills__Skill__c> oldskills = [SELECT Id, Name FROM RHA_Skills__Skill__c];
Map<Id, ResourceHeroApp__Skill__c> newskills_forinsert = new Map<Id, ResourceHeroApp__Skill__c>();
for (RHA_Skills__Skill__c oldskill : oldskills) {
newskills_forinsert.put(oldskill.Id, new ResourceHeroApp__Skill__c(Name = oldskill.Name, ResourceHeroApp__Type__c = 'General'));
}
if (newskills_forinsert.size() > 0) {
insert newskills_forinsert.values();
}
//Migrate skill assignments
List<RHA_Skills__Skill_Assignment__c> oldskillassignments = [SELECT Id, Name, RHA_Skills__Skill__c, RHA_Skills__Resource__c FROM RHA_Skills__Skill_Assignment__c];
List<ResourceHeroApp__Skill_Assignment__c> newskillassignments_forinsert = new List<ResourceHeroApp__Skill_Assignment__c>();
for (RHA_Skills__Skill_Assignment__c oldskillassignment : oldskillassignments) {
ResourceHeroApp__Skill_Assignment__c newskillassignment = new ResourceHeroApp__Skill_Assignment__c();
newskillassignment.ResourceHeroApp__Skill__c = newskills_forinsert.get(oldskillassignment.RHA_Skills__Skill__c).Id;
newskillassignment.ResourceHeroApp__Resource__c = oldskillassignment.RHA_Skills__Resource__c;
newskillassignments_forinsert.add(newskillassignment);
}
if (newskillassignments_forinsert.size() > 0) {
insert newskillassignments_forinsert;
}
//Migrate skill requirements
List<RHA_Skills__Required_Skill__c> oldrequirements = [SELECT Id, Name, RHA_Skills__Skill__c, RHA_Skills__Resource_Assignment__c FROM RHA_Skills__Required_Skill__c];
Map<Id, ResourceHeroApp__Assignment_Requirement__c> newrequirements_forinsert = new Map<Id, ResourceHeroApp__Assignment_Requirement__c>();
for (RHA_Skills__Required_Skill__c oldrequirement : oldrequirements) {
ResourceHeroApp__Assignment_Requirement__c newrequirement = new ResourceHeroApp__Assignment_Requirement__c();
newrequirement.ResourceHeroApp__Resource_Assignment__c = oldrequirement.RHA_Skills__Resource_Assignment__c;
newrequirement.ResourceHeroApp__Field_Skill_Identifier__c = newskills_forinsert.get(oldrequirement.RHA_Skills__Skill__c).Id;
newrequirement.ResourceHeroApp__Operator__c = 'is assigned';
newrequirement.ResourceHeroApp__Type__c = 'Skill';
newrequirements_forinsert.put(oldrequirement.Id, newrequirement);
}
if (newrequirements_forinsert.size() > 0) {
insert newrequirements_forinsert.values();
}
}
}
Migrator Test Class
@isTest
public with sharing class MigratorTest {
@testSetup
static void testSetupMethod() {
ResourceHeroApp.RHA_Utility rhau = new ResourceHeroApp.RHA_Utility();
rhau.createAllCustomSettings();
List<Opportunity> opps = new List<Opportunity>();
opps.add(new Opportunity(Name = 'Test Opp 1', StageName = 'Prospecting', CloseDate = date.Today()));
insert opps;
List<ResourceHeroApp__Resource__c> res = new List<ResourceHeroApp__Resource__c>();
res.add(new ResourceHeroApp__Resource__c(Name = 'Olivia White', ResourceHeroApp__Weekly_Target_Min_Hours__c = 30, ResourceHeroApp__Weekly_Target_Max_Hours__c = 40));
res.add(new ResourceHeroApp__Resource__c(Name = 'Owen Harris', ResourceHeroApp__Weekly_Target_Min_Hours__c = 30, ResourceHeroApp__Weekly_Target_Max_Hours__c = 40));
insert res;
List<RHA_Skills__Skill__c> skills = new List<RHA_Skills__Skill__c>();
skills.add(new RHA_Skills__Skill__c(Name = 'Test SKill A'));
skills.add(new RHA_Skills__Skill__c(Name = 'Test SKill B'));
skills.add(new RHA_Skills__Skill__c(Name = 'Test SKill C'));
insert skills;
List<RHA_Skills__Skill_Assignment__c> skillassignments = new List<RHA_Skills__Skill_Assignment__c>();
skillassignments.add(new RHA_Skills__Skill_Assignment__c(RHA_Skills__Skill__c = skills[0].Id, RHA_Skills__Resource__c = res[0].Id));
skillassignments.add(new RHA_Skills__Skill_Assignment__c(RHA_Skills__Skill__c = skills[1].Id, RHA_Skills__Resource__c = res[0].Id));
skillassignments.add(new RHA_Skills__Skill_Assignment__c(RHA_Skills__Skill__c = skills[2].Id, RHA_Skills__Resource__c = res[1].Id));
insert skillassignments;
ResourceHeroApp__Resource_Assignment__c ra_forinsert = new ResourceHeroApp__Resource_Assignment__c();
ra_forinsert.ResourceHeroApp__Role__c = 'Account Manager';
ra_forinsert.ResourceHeroApp__Opportunity__c = opps[0].Id;
insert ra_forinsert;
List<RHA_Skills__Required_Skill__c> requiredskills = new List<RHA_Skills__Required_Skill__c>();
requiredskills.add(new RHA_Skills__Required_Skill__c(RHA_Skills__Skill__c = skills[0].Id, RHA_Skills__Resource_Assignment__c = ra_forinsert.Id));
requiredskills.add(new RHA_Skills__Required_Skill__c(RHA_Skills__Skill__c = skills[1].Id, RHA_Skills__Resource_Assignment__c = ra_forinsert.Id));
requiredskills.add(new RHA_Skills__Required_Skill__c(RHA_Skills__Skill__c = skills[2].Id, RHA_Skills__Resource_Assignment__c = ra_forinsert.Id));
insert requiredskills;
}
static testMethod void test_Migrator() {
Migrator.migrateSkills();
List<ResourceHeroApp__Skill__c> new_s = [SELECT Id FROM ResourceHeroApp__Skill__c];
List<ResourceHeroApp__Skill_Assignment__c> new_sa = [SELECT Id FROM ResourceHeroApp__Skill_Assignment__c];
List<ResourceHeroApp__Assignment_Requirement__c> new_ar = [SELECT Id FROM ResourceHeroApp__Assignment_Requirement__c];
system.assertEquals(3, new_s.size());
system.assertEquals(3, new_sa.size());
system.assertEquals(3, new_ar.size());
}
}