Skip to content

Commit

Permalink
Merge pull request dimagi#103 from tstalka/diff_name
Browse files Browse the repository at this point in the history
248812: EV Net Diff, problem with long Opportunity name
  • Loading branch information
tstalka authored Mar 3, 2017
2 parents e002935 + 06dff91 commit 6203a35
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/classes/NetEVDifferenceTriggerGateway.cls
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,15 @@ public class NetEVDifferenceTriggerGateway {

for (Pipeline_Snapshot__c snapshot : priorMonthSnapshotRecords.values()) {
Pipeline_Snapshot_EV_DIff__c snapShotsDiff = new Pipeline_Snapshot_EV_DIff__c();
snapShotsDiff.Name = snapshot.Opportunity_Name__c + ' - ' + currentDate.month() + '/' + currentDate.year();
String nameSuffix = ' - ' + currentDate.month() + '/' + currentDate.year();
String namePrefix = snapshot.Opportunity_Name__c;

if (namePrefix != null && namePrefix.length() + nameSuffix.length() > 80) {
Integer charsToCut = namePrefix.length() - (namePrefix.length() + nameSuffix.length() - 80);
namePrefix = namePrefix.subString(0, charsToCut);
}

snapShotsDiff.Name = namePrefix + nameSuffix;
snapShotsDiff.Opportunity_Name__c = snapshot.Opportunity_Name__c;
snapShotsDiff.Month_Date__c = currentDate;

Expand Down

0 comments on commit 6203a35

Please sign in to comment.