Added Custom Label for Field Exclusing functionality
This commit is contained in:
1 parent
60121072b9
commit
e16023a4af
3 files changed
+33
-1
No files matched your search
@@ -35,5 +35,20 @@ package.xml
|
|||||||
# Exclude Custom Fields
|
# Exclude Custom Fields
|
||||||
*.field
|
*.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
|
# Exclude the Opportnity CustomObject
|
||||||
Opportunity.object
|
Opportunity.object
|
||||||
@@ -85,6 +85,11 @@ public with sharing class OpportunityCloneService {
|
|||||||
@AuraEnabled
|
@AuraEnabled
|
||||||
public static Id CloneOpportunityWithChildren(Id oppId, Map<String,String> newValues,
|
public static Id CloneOpportunityWithChildren(Id oppId, Map<String,String> newValues,
|
||||||
List<String> childRelationshipsToClone) {
|
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.
|
//dynamic query in order to find the original opportunity.
|
||||||
String originalOppQueryString = ObtainQueryStringForOppAndChildren(oppId, childRelationshipsToClone);
|
String originalOppQueryString = ObtainQueryStringForOppAndChildren(oppId, childRelationshipsToClone);
|
||||||
System.debug(LoggingLevel.INFO,'\n\n*****\nQuery: ' + originalOppQueryString + '\n*****\n\n');
|
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()){
|
for(String fieldName:newValues.keySet()){
|
||||||
clonedOpp.put(fieldName, CreateObjectValueFromString(fieldName,newValues.get(fieldName)));
|
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
|
//insert the new Opportunity
|
||||||
try{
|
try{
|
||||||
insert clonedOpp;
|
insert clonedOpp;
|
||||||
|
|||||||
@@ -6,6 +6,14 @@
|
|||||||
<language>en_US</language>
|
<language>en_US</language>
|
||||||
<protected>true</protected>
|
<protected>true</protected>
|
||||||
<shortDescription>SmartClone Child List</shortDescription>
|
<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>
|
</labels>
|
||||||
</CustomLabels>
|
</CustomLabels>
|
||||||
Reference in new issue
Block a user