I would do some example with Continuation and I'm using Apex code on Apex Developer Guide.

When I click to save my code I receive this error message:

Constructor not defined: [Continuation].(Integer)

Repeat, I copied and pasted code from Guide.

This is Controller:

public with sharing class ContinuationController {
  // Unique label corresponding to the continuation
  public String requestLabel;
  // Result of callout
  public String result {get;set;}
  // Callout endpoint as a named credential URL 
  // or, as shown here, as the long-running service URL
  private static final String LONG_RUNNING_SERVICE_URL = 
    '<Insert your service URL>';

  // Action method
  public Object startRequest() {
    // Create continuation with a timeout
    Continuation con = new Continuation(40);
    // Set callback method
    // Create callout request
    HttpRequest req = new HttpRequest();

    // Add callout request to continuation
    this.requestLabel = con.addHttpRequest(req);

    // Return the continuation
    return con;  
  }// Callback method 

  public Object processResponse() {   
    // Get the response by using the unique label
    HttpResponse response = Continuation.getResponse(this.requestLabel);
    // Set the result variable that is displayed on the Visualforce page
    this.result = response.getBody();

    // Return null to re-render the original Visualforce page
    return null;
  • can you provide code with this problem? Jul 19, 2017 at 15:22
  • It definitely works. You'll want to edit your question and show some code.
    – sfdcfox
    Jul 19, 2017 at 15:24
  • Please show the code where you call the constructor.
    – Adrian Larson
    Jul 19, 2017 at 15:32
  • Continuation con = new Continuation(40);
    – vt89
    Jul 19, 2017 at 15:33
  • Also, it's generally advisable to provide a link when referencing online material.
    – Adrian Larson
    Jul 19, 2017 at 15:33

1 Answer 1


Based on the code you've posted, it seems that you have a class named Continuation. You should rename the class so it does not conflict with the built-in class. Alternatively, you can fix it locally by using the System namespace:

System.Continuation con = new System.Continuation(40);
  • @vt89 We all have days like that. Glad I could help!
    – sfdcfox
    Jul 19, 2017 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .