Created
January 31, 2018 20:47
-
-
Save escgeek/24697ab778509791f95f1ec1495270ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void setBUKey(List<Business_Metrics__c> newTrigger){ | |
String buKeyList; | |
String buKey; | |
Map<String,Business_Unit__c> buMap = Business_Unit__c.getAll(); | |
for(Business_Metrics__c bmx : newTrigger){ | |
buKey = NULL; | |
if(bmx.Business_Unit__c != NULL){ | |
buKeyList = bmx.Business_Unit__c; | |
List<String> buValues = buKeyList.split(';'); | |
for(string s : buValues){ | |
system.debug('s: ' + s); | |
if(buKey == NULL){ | |
buKey = buMap.get(s).Key__c; | |
} | |
else{ | |
buKey = buKey + ', ' + buMap.get(s).Key__c; | |
} | |
} | |
bmx.Business_Unit_Key__c = buKey; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment