+ Start a Discussion
cpo87cpo87 

How to fire trigger when field is updated due to system time update, not UI Edit.

Last Conversation Date - (Date field)

Days Since Last Conversation Date - (Formula field) = Now() - Last Conversation Date

Account Status - (Picklist field)

 

Here is what I'm trying to do.  I have a field on accounts that shows the date of a last conversation.  I have another field that calculates how many days it's been since that last conversation.  When this field hits 121 days I want to update a picklist field on the account to say "Needs Contact".  The Days Since Last Conversation Date formula is being updated by the system time updating, not an active UI edit.  Because of this I can't use a WorkFlow to update the Account Status.  When I've tried the WorkFlow doesn't fire because it isn't recognizing that an update took place.  I have also tried to create a trigger to make this work to no avail.  Here is my trigger.

 

 

trigger ProtectedStatusUpdate on Account (before update) {

    Account acct = Trigger.new[0];
     
//check to see if the Days Since Last Meaningful Conversation Date is greater than 120
    if(acct.Days_Since_Last_Activity_Modified_Date__c == 121){
      if(acct.Account_Rank__c == 'Sales Hot' || acct.Account_Rank__c == 'Sales Warm' || acct.Account_Rank__c == 'Sales Cool'){
      acct.Account_Rank__c = 'Needs Contact';
      }
     }
}

 Any suggestions would be greatly appreciated.

 

Thanks,

 

Christian

 

DluDlu

Christian,

If you use a time dependent workflow action, you should be able to accomplish this. Create a rule criteria (i.e., Last Conversion date not equal to null), then create a time dependent workflow action for 121 days after the Conversion Date and associate a field update to it. 

 

Diane

cpo87cpo87

Unfortunately I don't think that works.  To create a time dependant workflow you need to choose Evaluation Criteria that fires when a record is created or edited and did not previously meet the rule criteria or only when a record is created.  In this case the record needs to always be marked as "Needs Contact" every time the "Last Meaningful Conversation Date" becomes more than 120 days ago.  This means that this rule might have to fire up to 3 times a year for each account. Using a time dependant workflow the most I could ever have this fired is once.

 

Unless I'm missing something here.

 

Thanks,

 

Christian