Added Custom Label for Field Exclusing functionality

This commit is contained in:
Christopher Gary committed 2021-04-16 17:31:01 -04:00
1 parent 60121072b9
commit e16023a4af
3 files changed
+33 -1

No files matched your search

+15
View File
@@ -35,5 +35,20 @@ package.xml
# Exclude Custom Fields
*.field
# Exclude specific objects
OpportunityStageHistory__c.object
# Exclude specific classes
OppStageService.cls
OppStageServiceTest.cls
OpportunityTriggerHandler.cls
OpportunityTriggerHandlerTest.cls
# Exclude Specific Triggers
OpportunityTrigger.trigger
# Exclude Report Types
*.reportType
# Exclude the Opportnity CustomObject
Opportunity.object
@@ -85,6 +85,11 @@ public with sharing class OpportunityCloneService {
@AuraEnabled
public static Id CloneOpportunityWithChildren(Id oppId, Map<String,String> newValues,
List<String> childRelationshipsToClone) {
String oppFieldListToClearString = Label.SmartCloneForceClearFieldList;
List<String> oppFieldListToClear = new List<String>();
if(!oppFieldListToClearString.contains('N/A')){
oppFieldListToClear = oppFieldListToClearString.split(';');
}
//dynamic query in order to find the original opportunity.
String originalOppQueryString = ObtainQueryStringForOppAndChildren(oppId, childRelationshipsToClone);
System.debug(LoggingLevel.INFO,'\n\n*****\nQuery: ' + originalOppQueryString + '\n*****\n\n');
@@ -100,6 +105,10 @@ public with sharing class OpportunityCloneService {
for(String fieldName:newValues.keySet()){
clonedOpp.put(fieldName, CreateObjectValueFromString(fieldName,newValues.get(fieldName)));
}
//clear out field values listed
for(String fieldName:oppFieldListToClear) {
clonedOpp.put(fieldName,null);
}
//insert the new Opportunity
try{
insert clonedOpp;
@@ -6,6 +6,14 @@
<language>en_US</language>
<protected>true</protected>
<shortDescription>SmartClone Child List</shortDescription>
<value>OpportunityLineItem</value>
<value>N/A</value>
</labels>
<labels>
<fullName>SmartCloneForceClearFieldList</fullName>
<categories>SmartClone Config</categories>
<language>en_US</language>
<protected>true</protected>
<shortDescription>SmartCloneForceClearFieldList</shortDescription>
<value>N/A</value>
</labels>
</CustomLabels>