top of page

Entry point for Synchronous and Asynchronous methods

public with sharing class futureexperiment {


private static Boolean futuresent = false;

public static void test2()

{

//entry point for synchronous method call

//call it within the future call context

if(System.isFuture() || system.isBatch())

{

test2sync();

return;

}

//immediately return if the future call is already made

if(futuresent) return;

//else flag the static variable before making the future call

futuresent = true;

//entry point for future call

//when not in the future call context

test2future();

}

@future

public static void test2future()

{

test2sync();

}

public static void test2sync()

{

system.debug('performing operation sync or async');

}

}

Recent Posts

See All

Comments


Post: Blog2_Post

©2020 by SalesforceDemystified. Proudly created with Wix.com

bottom of page