+ Start a Discussion
Ramk123Ramk123 

Update Long Text area field based multi Select Pick list Value selected

I have Review(Multi-Select Picklist) field with values following.
101(Previous grant)
101(No Expectation)
101(Sufficient Income)
101(Long Term)

Based on the above values selected update Review Log (Long Text Area) field.
I tried like below, but am getting an error message like "Error  Field Review__c may not be used in this type of formula "

IF(INCLUDES( Review__c, "101(Not Unforeseen)"), "$Label.X101_Not_Unforeseen", NULL ) + BR() +
IF(INCLUDES( Review__c, "101(Previous grant)"), "$Label.Previous_grant", NULL ) + BR() +
IF(INCLUDES( Review__c, "101(No Expectation)"), "$Label.No_Expectation", NULL ) + BR() +
IF(INCLUDES( Review__c, "101(Sufficient Income)"), "$Label.X101_Sufficient_Income", NULL ) + BR() +
IF(INCLUDES( Review__c, "101(Long Term)"), "$Label.X101_Long_Term", NULL )
  
Note: Long Text referring from Label

Appreciate quick help on this!
 
Best Answer chosen by Ramk123
SAKTHIVEL MSAKTHIVEL M
Hi Ramesba,

Use the apex trigger and below are the sample.

 
trigger AccountAddressTrigger on Account (before insert, before update) {

 Set<String> reviewList = new Set<String>();  
 
    for(Account a : trigger.new) {
        if( a.Review__c!= null){
            List<String> review = a.Review__c.split(';');
            reviewList.addAll(review);
        }
        
        string reviewLogs = '';
        if(reviewList.size()>0) {
            
            for(string r: reviewList) {
                if(r == 'Not Unforeseen') {
                    reviewLogs += Label.Not_Unforeseen+'\n';
                }
                if(r == 'Previous grant') {
                    reviewLogs += Label.Previous_grant+'\n';
                }
                if(r == 'No Expectation') {
                    reviewLogs += Label.Not_Unforeseen+'\n';
                }
                if(r == 'Sufficient Income') {
                    reviewLogs += Label.Sufficient_Income+'\n';
                }
                if(r == 'Long Term') {
                    reviewLogs += Label.Long_Term+'\n';
                }
            }
        }
        a.Review_Log__c = reviewLogs;
    }
    
}

Please try it and let me know if you facing any issues.

Thanks & Regards,
Sakthivel Madesh

All Answers

SAKTHIVEL MSAKTHIVEL M
Hi Ramesba,

from which way you are trying to update Review Log (Long Text areafield), using trigger/workflow field update/process builder?

Please confirm to help further!

Thanks & Regards,
Sakthivel Madesh
Ramk123Ramk123
Hi Sakthlvel,

Thank you much for the quick response!

The above formula I wrote in Review(Text area) field. 

Workflow, Process builder, and Trigger are also a good idea.

Could you please suggest me the best solutions?
Thank you much for the quick response!

If possible workflow/Process builder, otherwise Trigger.
Could you please suggest me the best solutions?

Thanks,
Ramesba
 
SAKTHIVEL MSAKTHIVEL M
Hi Ramesba,

Use the apex trigger and below are the sample.

 
trigger AccountAddressTrigger on Account (before insert, before update) {

 Set<String> reviewList = new Set<String>();  
 
    for(Account a : trigger.new) {
        if( a.Review__c!= null){
            List<String> review = a.Review__c.split(';');
            reviewList.addAll(review);
        }
        
        string reviewLogs = '';
        if(reviewList.size()>0) {
            
            for(string r: reviewList) {
                if(r == 'Not Unforeseen') {
                    reviewLogs += Label.Not_Unforeseen+'\n';
                }
                if(r == 'Previous grant') {
                    reviewLogs += Label.Previous_grant+'\n';
                }
                if(r == 'No Expectation') {
                    reviewLogs += Label.Not_Unforeseen+'\n';
                }
                if(r == 'Sufficient Income') {
                    reviewLogs += Label.Sufficient_Income+'\n';
                }
                if(r == 'Long Term') {
                    reviewLogs += Label.Long_Term+'\n';
                }
            }
        }
        a.Review_Log__c = reviewLogs;
    }
    
}

Please try it and let me know if you facing any issues.

Thanks & Regards,
Sakthivel Madesh
This was selected as the best answer