+ Start a Discussion
Akshay ShrivastavaAkshay Shrivastava 

concatenate string with custom field using trigger

trigger OrderOfExecutionBeforeTrigger on OrderOfExecution__c (before update) {
    list<OrderOfExecution__c> OexString= new list<OrderOfExecution__c>();
    
    for(OrderOfExecution__c Oex : trigger.new)
    {
        OexString=Oex.execute__c;
        Oex.Execute__c= OexString + 'BeforeTrigger';
        update Oex.Execute__c;
    }
    
}


can anyone help me
Best Answer chosen by Akshay Shrivastava
CharuDuttCharuDutt
Hii Akshay
Try Below Code
trigger OrderOfExecutionBeforeTrigger on OrderOfExecution__c (before update) {
    String OexString ;

    for(OrderOfExecution__c Oex : trigger.new)
    {
        OexString = Oex.Execute__c;
        Oex.Execute__c = OexString + 'BeforeTrigger';
       
    }
	
    
}
Please Mark It As Best Answer If It Helps
Thank You! 

All Answers

CharuDuttCharuDutt
Hii Akshay
Try Below Code
trigger OrderOfExecutionBeforeTrigger on OrderOfExecution__c (before update) {
    String OexString ;

    for(OrderOfExecution__c Oex : trigger.new)
    {
        OexString = Oex.Execute__c;
        Oex.Execute__c = OexString + 'BeforeTrigger';
       
    }
	
    
}
Please Mark It As Best Answer If It Helps
Thank You! 
This was selected as the best answer
AbhinavAbhinav (Salesforce Developers) 
Hi Akshay,

is it you just want to append  BeforeTrigger with your field execute__c on update operation ?  if so 

try below code
trigger OrderOfExecutionBeforeTrigger on OrderOfExecution__c (before update)
{
   
  for(OrderOfExecution__c Oex : trigger.new)
    {
        
        Oex.execute__c = Oex.execute__c + ' BeforeTrigger';
        
    }
}

Let me know if you have other requirement on this.

If it helps ,mark it as best answer.

Thanks!
ravi soniravi soni
Hy akshay,
try below code.
trigger OrderOfExecutionBeforeTrigger on OrderOfExecution__c (before update)
{
   
  for(OrderOfExecution__c Oex : trigger.new)
    {
        
        Oex.execute__c = Oex.execute__c + ' BeforeTrigger';
        
    }
}

don't forget to mark it as best answer.
thank you