+ Start a Discussion
sheila srivatsavsheila srivatsav 

JobID for a future Method

I am working on @Future methods and quueueable apex.

we can monitor queueable job from apex jobs, get JOB ID and check the status of queueable apex job using the object AsynApexJob from workbench.

a] My question is can we do all of the above for a method marked with @future?

b] can we use database.stateful with queueable apex?

c] can we schedule a queueable job by specifying a cron string ?

c]  what is flexipage queue and how does it work..

Please elaborate in details and I request forum memebers to be specific.

thanks
sheila
Best Answer chosen by sheila srivatsav
v varaprasadv varaprasad
Hi Shelia,

Please check once below sample snippet code : 
public class FutureClass {
    @future
    public static void futureMethod(){
        system.debug('Your Name is : '+Userinfo.getName());        
    }

}

Execute below the line in Anonymus window :
FutureClass.futureMethod();

User-added image

Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
 

All Answers

v varaprasadv varaprasad
Hi Shelia,

a] My question is can we do all of the above for a method marked with @future?
    Yes, we can do,

b] can we use the database. stateful with queueable apex?
  No Need .we have only one method in the queueable apex.

c] can we schedule a queueable job by specifying a cron string ?
 No, we can't.

d]  what is a flexipage queue and how does it work..
  If we have multiple queue jobs then we can reorder them using apex flex ui.

Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
 
sheila srivatsavsheila srivatsav
Hi varaprasad
Thanks for your reply.
Actually any sepcific example can you show on how to have create future method and see the job  with ID.
v varaprasadv varaprasad
Hi Shelia,

Please check once below sample snippet code : 
public class FutureClass {
    @future
    public static void futureMethod(){
        system.debug('Your Name is : '+Userinfo.getName());        
    }

}

Execute below the line in Anonymus window :
FutureClass.futureMethod();

User-added image

Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
 
This was selected as the best answer
sheila srivatsavsheila srivatsav
Hi
Like one more issue. can we scheule a future job, like wise I create a cronstring with specific date and time,
so can I scheule the future job?

thanks
sheila