Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
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
4 answers
  1. Feb 3, 2020, 9:11 PM
    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;

            }
Loading
0/9000