You need to sign in to do that
Don't have an account?
Luke Bray 9
Populate a field based on value of multiple fields
I have a custom field, Field A. This field should be populated with one of 3 values based on the combination of 3 other fields Field 1, Field 2 and Field 3.
There are 44 different possible combinations of Fields 1, 2 and 3 so making Field A a formula field is not possible due to character limits.
I have tried to make a concatenation formula field of fields 1, 2 and 3 however still can have 44 possible concatenations and do not know of a good way to use this field to populate Field A.
Can anyone suggest what I might do here?
There are 44 different possible combinations of Fields 1, 2 and 3 so making Field A a formula field is not possible due to character limits.
I have tried to make a concatenation formula field of fields 1, 2 and 3 however still can have 44 possible concatenations and do not know of a good way to use this field to populate Field A.
Can anyone suggest what I might do here?
You will have to switch to customization here.
Field A will be updated from backend Apex code using trigger.
All 44 possible combination needs to be configured somewhere (Custom label with comma spearated values, custom setting or custom metadata type).
psedo trigger will look something like this.
Trigger on sobject (before insert, before update){
list<String> possibleCombinations = system.label.possibleCombinations.Split(',');
for(sobject obj : trigger.new ){
String combinedFieldValues = obj.Field_1__c + obj.Field_2__c + obj.Field_3__c ;
if(possibleCombinations.contains(combinedFieldValues )){
obj.Field_A__c = combinedFieldValues;
}
}
}
Best Regards,
Ashvin
All Answers
Greetings!
You can achieve this using process builder please refer the below blog for the sample process builder with the screenshots:
https://www.forcetalks.com/salesforce-topic/how-to-concatenate-two-and-more-field-values-in-formula-of-salesforce-process-builder/
Please mark it as best answer if it helps you to fix the issue.
Thank you!
Regards,
Shirisha Pathuri
I suppose I could have a process builder with 44 nodes but that will be cumbersome and not very practical to maintain.
You will have to switch to customization here.
Field A will be updated from backend Apex code using trigger.
All 44 possible combination needs to be configured somewhere (Custom label with comma spearated values, custom setting or custom metadata type).
psedo trigger will look something like this.
Trigger on sobject (before insert, before update){
list<String> possibleCombinations = system.label.possibleCombinations.Split(',');
for(sobject obj : trigger.new ){
String combinedFieldValues = obj.Field_1__c + obj.Field_2__c + obj.Field_3__c ;
if(possibleCombinations.contains(combinedFieldValues )){
obj.Field_A__c = combinedFieldValues;
}
}
}
Best Regards,
Ashvin