3

I am already using a workaround to allow reporting on approval process steps (field updates to the record, track the history of the field), except that now I can't report on the field history that is being captured. Does anyone know of a workaround that would allow me to report on this tracked data?

Thanks!

EDIT: One thought I had was to create date fields for each step in the process and have the approval step update the relevant date field with NOW().

3
  • success.salesforce.com/questionDetail?qid=a1X30000000HYToEAO ..currently this is under salesforce ideas and whatever you are telling will work Commented Oct 22, 2012 at 18:40
  • Have you considered having your own history object which you sync to using a trigger? If that's the only possible solution. Commented Oct 22, 2012 at 20:15
  • The method I used, which ended up working, was to create date/time fields for each step in the process and have a field update on each step update the date field with the formula NOW(). I then have a formula field take the difference between the date/time field for step 2 and the date/time field for step 1 to see how long the step took to complete. Commented Oct 23, 2012 at 15:37

2 Answers 2

3

I think the best way for now would be to create a custom object which has the following fields:

Object Lookup -> Child__c
Object Lookup -> Parent__c
Field (same type as field to be tracked) -> NewValue__c
Field (same type as field to be tracked) -> OldValue__c

Then use a trigger on the child object to create a new record each time the field in question is updated (pseudocode):

trigger ChildObject_AfterUpdate on ChildObject(after update)
{
  list<FieldHistory__c> changes = new List<FieldHistory__c>(); 

  for(ChildObject o : trigger.new)
  {
    if(o.TheField != trigger.oldMap(o.Id).TheField)
    {
      FieldHistory__c  fh = new FieldHistory__c();
      fh.Parent__c = o.ParentId;
      fh.Child__c = o.Id;
      fh.OldValue__c = trigger.oldMap(o.Id).TheField;
      fh.NewValue__c = trigger.TheField;
      changes.add(fh);
    }
  }
  update changes;
}

Note that I didn't include a date field because we've already got that thanks to the system field CreatedDate.

0

The method I ended up using, which is working well so far, was to:

  • Create date/time fields for each step in the process
  • Have a field update on each step of the approval process update the date/time field with the formula NOW()
  • Then have a formula field take the difference between the date/time field for step 2 and the date/time field for step 1 to see how long the step took to complete

This was relatively easy to set up (no coding) and easy to report on, so I would recommend it as a viable workaround for anyone stuck in a similar situation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .