+ Start a Discussion
dfpittdfpitt 

Email Alert goes out with field history info that is not up to date

Hello,

 

I have a few sensitive fields in a custom object that whenever they are changed a workflow rule sends out a VF Email.

 

This VF email, among other things, prints the field history table for the record in the email.

 

When I make a change in one of these fields, the email is sent. But, the printed field history table is missing the most recent change.

 

It feels like the workflow rule is being executed before the new change is inserted into the field history table. Anybody knows if this assumption is right? and if so, what can I do to get an email with the fully updated field history, without resorting to a time-based workflow rule, which will have me wait for at least an hour to get the email.

 

thanks in advance

 

dfpitt

 

skodisanaskodisana

Hi,

 

Can you have your workflow rule criteria more specific. I mean use ISCHANGED function in the rule criteria on specific field and try.

This is my guess, please try  it, for the same workflow rule create a dummy field update and check the checkbox Re-evaluate Workflow Rules AfterField Change checkbox on the Field Update. 

 

Thanks,

Srikanth. K

dfpittdfpitt

Thanks for your suggestion Srikanth.

 

I'm not exactly sure what you mean. So let me be more specific about the setup.

 

I have a custom object named CO1__c, which has a custom field named CF1__c.

 

I have a workflow rule named WF1 on object CO1__c with the following criteria:

    - Evaluate rule: Every time a record is created or edited

    - Rule Criteria: AND(ISNEW()=false, ISCHANGED( CF1__c)=true)

 

WF1 executes a field update on CO1__c, changing a custom field named flag_updated__c to TRUE (this field update IS marked to "Re-evaluate Workflow Rules AfterField Change")

 

I have another workflow rule named WF2 on object CO1__c with the following criteria:

    - Evaluate rule: Every time a record is created or edited

    - Rule Criteria: flag_updated__c=TRUE

 

WF2 sends out the email alert and executes a field update on CO1__c, changing the custom field flag_updated__c back to FALSE

 

The reason I'm using the field update to call out WF2 instead of just sending out the email alert with a single workflow rule, is because I have other custom objects (which have a master-detail relationship with CO1__c, where CO1__c is the master) that also change the flag_updated__c to TRUE when specific fields in those objects change as well.

 

Hopefully this doesn't sound confusing

 

dfpitt