• Deepthisfdc
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hello Everyone,

 

I am new to the Salesforce development.Below is the trigger :

 

trigger trgUpdateComments on Task (before update)
{          
    DateTime d = system.now();
    for(task ta : trigger.new)
    {
        string dec = String.valueof(d) + '\n' + ta.Description ;
                ta.Description = dec;
         
    }    
}

 

What it does is that: whenever we enter any comment in the comments field on the tasks and save it.It will display the system date and time followed by the comment entered as below:


2012-09-27 10:25:41

Testing1

 

The problem is whenever I enter the second comment the format is as below:

 

2012-09-27 10:27:23

2012-09-27 10:25:41
Testing1

Testing2

 

But it should be as:

2012-09-27 10:27:23

Testing2

2012-09-27 10:25:41
Testing1

 

Can someone help me with this please.Thank you!!

 

Hello Everyone,

 

I am new to the Salesforce development.Below is the trigger :

 

trigger trgUpdateComments on Task (before update)
{          
    DateTime d = system.now();
    for(task ta : trigger.new)
    {
        string dec = String.valueof(d) + '\n' + ta.Description ;
                ta.Description = dec;
         
    }    
}

 

What it does is that: whenever we enter any comment in the comments field on the tasks and save it.It will display the system date and time followed by the comment entered as below:


2012-09-27 10:25:41

Testing1

 

The problem is whenever I enter the second comment the format is as below:

 

2012-09-27 10:27:23

2012-09-27 10:25:41
Testing1

Testing2

 

But it should be as:

2012-09-27 10:27:23

Testing2

2012-09-27 10:25:41
Testing1

 

Can someone help me with this please.Thank you!!