+ Start a Discussion
Always ThinkinAlways Thinkin 

Bug? Recent Items shows async created records

I've been developing some Apex code to automatically clone closed opps. It expands on code that creates cases for implementing services purchased. The only signficant change I've made from the original version of the code is to run it asynchronously (using @future) which causes the following strange behavior:

 

After the code executes, my recent items list contains all the records for the cases created as well as the account related to the opportunity even though I have not actually accessed these records through the UI.

 

If I remove the @future annotation the UI behaves as expected so it seems to be directly related to async.

 

Anyone seen behavior like this or have a good guess why it would happen?

 

 

 

cheenathcheenath

>>After the code executes, my recent items list contains all the records for the cases created as well as the account related to the opportunity even though I have not actually accessed these records through the UI.

 

Are you accessing them from the future method?

 

Always ThinkinAlways Thinkin

Only through DML statements that insert them and subsequently reference the new IDs for inclusion on other records. For example, a parent case is created, with data copied from the opportunity. Then two child cases are created that reference the ID of the newly created parent case.

 

The appearance of the account in the Recent Items is the most curious. The record is neither inserted nor updated in the method.  The AccountID is captured from the opportunity and assigned to the AccountID for the new cases.