• Andrec
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Hello,

 

We are having a strange behavior with a trigger here in our system, can anyone tell how we can have this behavior?

 

The process is like this:

 

 - A check box is selected on a visualpage and a record is updated.

 - After this update, the trigger fire and a master detail object record is created. This object is like a history log, where we store the action the user have done.

 - After this, the workflow rules start the avaliation and one workflow rule will calculate a new value for a field, because the check box was clicked, and that field will updated.

 

By here everything is ok, and working as expected. NEXT is the problem:

 

Sometime after the workflow rules, the trigget will fire again and will create a new History log, for the exact same action at the same time. But this only happens some times and we are not understanding why.

 

The Trigger look like this:

trigger InfoLog on Info_Demandante_APC__c (before update) {

    Info_Demandante_APC__c  infoOld = Trigger.old[0];
    Info_Demandante_APC__c  infoNew = Trigger.new[0];

    List<Info_log__c> newLogs = new List<Info_log__c>();

    if((infoOld.preguntas_criticas_completadas__c !=   infoNew.preguntas_criticas_completadas__c) 
&& infoNew.preguntas_criticas_completadas__c)                                        
{
            
            Info_log__c newLog =  new Info_log__c();
            newLog.Info_Demandante_APC__c = infoNew.id;
            newLog.Fecha__c = Datetime.now();
            newLog.Accion__c = 'Preguntas críticas';
            newLog.Descripcion__c = Datetime.now() + 
            ' - El demandante ha contestado a las preguntas críticas';
        
            newLogs.add(newLog);    
        

}

 insert newLogs;
}

 

Can you help me why we are having this behavior?

 

Thanks,

André Cunha

  • March 01, 2012
  • Like
  • 0

Hi,

 

How to integrate the google analytics with salesforce. Any one help me how to solve these.

 

Thanks,

Yamini.

  • August 31, 2011
  • Like
  • 0