function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sai RavulapatiSai Ravulapati 

can time based workflow field update can trigger after update method?

Hi,

I have a time-based workflow on the account which is updating a checkbox field to true when this action is executed I want my custom code to fire (after update) and make some updates on the object. Currently, the scheduled time-based action is changing to the future time when it comes to schedule execution time.

Thanks
SRKSRK

from your custom code are you making any changes to same check box or any other field which is included in the workflow entery critria ??

also did that reevalvute check box on your workflow is checked ??

are you updating the date field from you custom code on which you workflow depend ?

Sai RavulapatiSai Ravulapati
I am updating that checkbox to false in my custom code and reevaluate checkbox is false for 3 field updates which are used in the time-based workflow.
SRKSRK
if you update any field which is involved in you time dependedn workflow then salesfoce will reevalute your 
Sai RavulapatiSai Ravulapati
I've removed that field from the update. Currently, my time-based workflow is changing account owner, book3__c to false and Checkbox1__2 to true after 120 days of faileddate__c. So based on these changes I need to do some updates on the same record. This is my code firing at after update.

Id AccRecTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('MY RecordType').getRecordTypeId();
        
        for(Account acc:trigger.new){
            if(acc.Checkbox1__2 == TRUE && acc.recordTypeId == AccRecTypeId){ 
                if(acc.status != 'Now' && acc.status != 'Failed' && acc.status != 'Failed/Lost'
                    && acc.book1__c == FALSE && acc.book2__c == FALSE && acc.book3__c == FALSE 
                    && acc.Owner.LastName.contains('automation')){
                        acc.count= 0;
                        acc.dollors= 0;
                        accountListToUpdate.add(acc);
                    }
                    system.debug('===updatedAccIds==='+updatedAccIds);
            }
        }
if(!accountListToUpdate.isEmpty()){
            update accountListToUpdate;
        }