+ Start a Discussion
SandrineSandrine 

Refresh part of page at the end of Future method

Hello,

I have a trigger, which has future method in it.
This future method updates the fields or the trigger object.

I want to implement something which will refresh the part of the page , after the end of future method.

 
Best Answer chosen by Sandrine
Arun Deepan LJArun Deepan LJ
Hi,

You can have a Static variable, to track whether the future method is executed or not. Also have a check box in the page and  Once the static variable, becomes true, update that check box value to True. And in the page, based on that check box, you can render ro do some modifications

All Answers

AshlekhAshlekh
Hi,

First if you are using future method in Trigger than you need to follow best practise. Because furture method exceed the limit in Trigger if the reocrd are more than 50. You need to write code in that way future method invoked once only.

And  future method runs in the background, asynchronously so nobody know when will be the method complete.

You can try or use PushNotificaiton on page, when ever the record is updated then through pushnotification you can get the record value is updated and you need to refresh the page.

-Thanks
Ashlekh  Gera
Arun Deepan LJArun Deepan LJ
Hi,

You can have a Static variable, to track whether the future method is executed or not. Also have a check box in the page and  Once the static variable, becomes true, update that check box value to True. And in the page, based on that check box, you can render ro do some modifications
This was selected as the best answer
Sachin GahlotSachin Gahlot
Hi Arun/Sandrine,

Can you a provide a quick example using the code, how would you refresh the part of a vf page, once the future method is completed?

Thanks,
Sachin