0

We have a visualforce page and a controller,on a specific user event a future job is invoked from the controller.

What we want to accomplish is to show a progress bar like thing until the future job finishes. I know this is not a best practice,but we can't help it as we have to upload large files from salesforce to a legacy system through rest API. Trust me we tried all other approaches but this is what the business requires due to their strict compliances.

I tried using AsyncApexJob for this but it only gives ApexClassID and method that triggered the future and no way to find the user who scheduled it.

1 Answer 1

0

The CreatedById field should tell you whom fired off the future method. However, you should prefer to use Queueable in this case, which returns a JobId to you. You can use that Id to make sure you've selected the right job. The System.enqueueJob method returns the Id you want to use.

1
  • Thanks sfdc box,can't recollect how I missed CreatedById field. Seems Queueable is a better approach...Marking it as answer...
    – user4971
    Commented Aug 25, 2016 at 11:58

You must log in to answer this question.