-2

I have an long text box field that contains values. I need to append new values into the long text box field without overwriting the old values. Is it possible to populate the old values and add the new values without having to create a new temp field to store the new values temporarily and update the long textbox field with the new values from the temp field?

Thanks!

  • 6
    Yes, it's perfectly possible, but context is key. What exactly are you doing? What code have you tried so far? Which technology are we talking about (triggers, Visualforce, Lightning, etc)? Please give us some more details with an edit so we can help you find the answer you're seeking. – sfdcfox Feb 9 '18 at 17:04
0

Sorry, I should have posted what I had. I was able to achieve this by creating a map.

//Opp Recommendation update logic                        
                    if(mEmailInterest.get(e).Recommendation__c != NULL) {
                        System.debug('Opp Recommendation ID in Map -->' + mOppsToUpdate.containsKey(ou.Id)); 
                        //Opp exist in the map 
                        if(mOppsToUpdate.containsKey(ou.Id)){ 
                            //mOppsToUpdate.get(ou.Id); 
                            System.debug('Opp ID in Map -->' + mOppsToUpdate.containsKey(ou.Id)); 
                            if(mOppsToUpdate.get(ou.Id).Recommendation__c == NULL){
                                System.debug('Opp Recommendation INITIAL -->' + mOppsToUpdate.get(ou.Id).Recommendation__c); 
                                System.debug('Current status of mOppsToUpdate---> '+ mOppsToUpdate);
                                ou.Recommendation__c = System.today().format() + ': ' + mEmailInterest.get(e).Recommendation__c;
                                System.debug('Opp Recommendation 1 -->' + ou.Recommendation__c);
                            }else{
                                ou.Recommendation__c = System.today().format() + ': ' + mEmailInterest.get(e).Recommendation__c + ' \n  ' + mOppsToUpdate.get(ou.Id).Recommendation__c;
                                System.debug('Opp Recommendation 2 -->' + ou.Recommendation__c);
                            }
                              mOppsToUpdate.put(ou.Id,ou); 
                        }
                        //Opp doesn't exist in the map 
                        else {
                            if(ou.Recommendation__c == NULL){
                                ou.Recommendation__c = System.today().format() + ': ' + mEmailInterest.get(e).Recommendation__c;
                                System.debug('Opp Recommendation 3 -->' + ou.Recommendation__c);
                            } else{
                                ou.Recommendation__c = System.today().format() + ': ' + mEmailInterest.get(e).Recommendation__c + ' \n  ' + ou.Recommendation__c;
                                System.debug('Opp Recommendation 4 -->' + ou.Recommendation__c);
                            }             
                            mOppsToUpdate.put(ou.Id,ou); 
                            System.debug('OppRecommendation Map Check ---> '+ mOppsToUpdate); 
                        }
                    }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.