3

I'm not able to find documents on this topic.

If my update trigger updates an object which in turn fires a time-dependent workflow that updates a field named "workflowField__c"(update field , 1 hour after).

In my test code,

Test.StartTest();
update myobject;
Test.StopTest();

Should I expect the workflowField__c be updated after this code snippet?

The document of Test.StartTest() says:

You can also use this method with stopTest to ensure that all asynchronous calls that come after the startTest method are run before doing any assertions or testing.

But is the time-dependent workflow an asynchronous call?

0

1 Answer 1

1

That just enqueues a pending action, at which point the functionality is complete. It's analogous to when you schedule a job via Apex. It finishes scheduling it, but that doesn't mean the job gets run.

The records are of the WorkflowTimeQueue type. It's the data you can see when you go to Monitor > Time-Based Workflow. Unfortunately, it does not seem like you can query for it:

Querying Time-based Workflow Queue


Not sure what @Peter had to go on to determine Time-Based Workflow uses the EventLogFile object. Maybe they changed it since that post. What I did is I looked at the monitoring page and inspected the checkbox. It had a value="055000000000000" attribute. I used that in Execute Anonymous as follows:

system.debug(Id.valueOf('055000000000000').getSObjectType());

You must log in to answer this question.

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