I've spent many hours scouring the net and trying different coding options to get a very simple function accomplished, with no luck. There are no examples anywhere that I can find, and SF's documentation is typically unhelpful, hinting that the desired functionality is possible, but not enough information to implement. Is there anybody out there that can help?
I have a continuation in my VF page. I call its callout from a function started by a command button on the page. The command button function returns a pagereference, and the callback function of the continuation returns a pagereference. I want to get the pagereference returned by the continuation's callback and navigate to it. Obviously, to do this I want to wait until the callback is finished - I think the code does that but I am not certain.
CallScheduler();
PageReference pageRef = 'Return value from callback, how do i get it?';
pageRef.setRedirect(true);
return pageRef;
Here are the declarations of the callout and callback continuation methods:
public Object CallScheduler() {
Continuation con = new Continuation(30);
con.continuationMethod = 'SchedulerCalled';
HttpRequest req = new HttpRequest();
...
public PageReference SchedulerCalled() {
...
return new PageReference('/' + myNewRecord.id);
For those who want to recommend a change to the design, the continuation inserts a custom object that includes fields retrieved from an external web service call. The fields are required. The code must get 75% test coverage, and must pass force.com security and quality scanning.
public PageReference SchedulerCalled() {
topublic Object SchedulerCalled() {
– NSjonas Feb 3 '17 at 21:02