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

@@ -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;