How do I migrate Strategic Goal data to use KPIs?

OVERVIEW

For Cloud Coach users who are already using Strategic Goals to connect Projects, Programs, Portfolios, and Investments, a data migration must occur in order for the appropriate lookups to connect KPIs. First, a new object is created then data is migrated to it for temporary holding, the new package(s) are installed, the data is migrated to the updated object, and new object is deleted. This will maintain consistency throughout the product and needs to be completed once per sandbox or production instance.

STRATEGIC GOAL MIGRATION

1. Create SObject “Strategic_Goal_Alignment__c”

Label: Strategic Goal Alignment
Data Type: Auto Number

2. On new Strategic Goal Alignment object, create fields:

Name: Strategic Goal, 
Type: Lookup field 
Strategic_Goal__c” to Strategic Goals object

Name: Investment
Type: Lookup field
“Investment__c” to Investments object

Name: IsConverted
Type: checkbox field
Set default to “FALSE”

3. On existing Strategic Goal Alignment (ccpe_ppm__Strategic_Goal_Alignment__c) object, create field:

Name: IsConverted
Type: checkbox field
Set default to “FALSE”

3. Use Script provided to migrate data

Integer BATCH_SIZE = 5000;
List oldAlignments = [
SELECT
Id,
IsConverted__c,
ccpe_ppm__Strategic_Goal__c,
ccpe_ppm__Investment__c
FROM
ccpe_ppm__Strategic_Goal_Alignment__c
WHERE IsConverted__c != true
LIMIT
:BATCH_SIZE
];
if(oldAlignments != null && !oldAlignments.isEmpty()) {
List tempAlignments = new List();
for(ccpe_ppm__Strategic_Goal_Alignment__c oldAlignment : oldAlignments) {
tempAlignments.add(new Strategic_Goal_Alignment__c(
Investment__c = oldAlignment.ccpe_ppm__Investment__c,
Strategic_Goal__c = oldAlignment.ccpe_ppm__Strategic_Goal__c
));
oldAlignment.IsConverted__c = true;
}
System.SavePoint sp = Database.setSavepoint();
try {
insert tempAlignments;
update oldAlignments;
if(oldAlignments.size() < BATCH_SIZE) {
System.debug(‘Conversion Complete’);
}
} catch(Exception ex) {
Database.rollback(sp);
throw ex;
}
} else {
System.debug(‘Conversion Complete’);
}

4. Install Packages

Enterprise 10.000 or later

View latest Release Notes for installation information.

PPM 1.31 or later

Contact us at support@cloudcoach.com for installation URL

5. Use Script provided for final migrate data

Integer BATCH_SIZE = 5000;
List tempAlignments = [
SELECT
Id,
IsConverted__c,
Strategic_Goal__c,
Investment__c
FROM
Strategic_Goal_Alignment__c
WHERE IsConverted__c != true
LIMIT
:BATCH_SIZE
];
if(tempAlignments != null && !tempAlignments.isEmpty()) {
List newAlignments = new List();
for(Strategic_Goal_Alignment__c tempAlignment : tempAlignments) {
newAlignments.add(new ccpe_ppm__Strategic_Goal_Alignment2__c(
ccpe_ppm__Investment__c = tempAlignment.Investment__c,
ccpe_ppm__Strategic_Goal__c = tempAlignment.Strategic_Goal__c
));
tempAlignment.IsConverted__c = true;
}
System.SavePoint sp = Database.setSavepoint();
try {
insert newAlignments;
update tempAlignments;
if(tempAlignments.size() < BATCH_SIZE) {
System.debug(‘Conversion Complete’);
}
} catch(Exception ex) {
Database.rollback(sp);
throw ex;
}
} else {
System.debug(‘Conversion Complete’);
}

6. Confirm migration success & delete records and object

When data migration confirmed:
Delete all temporary “Strategic_Goal_Alignment__c” records and object
Delete old “ccpe_ppm__Strategic_Goal__Alignment__c” object

Was this article helpful?

Related Articles