I'm getting an error when I am call non void method from REST API class. Trying to add the Rest Response id in contract object.

trigger RestAPIcalloutTrigger on Contract (after insert , after Update) {

    Integer CaseID;

    CreateCasesByContract cc = New CreateCasesByContract();
    List<Contract> CList = New List<Contract>();
    for(Contract c : Trigger.New)

        if(c.Broker_Involved__c ==  'yes' )
            c.BCR_Case_Id__c = cc.CreateCase();
            c.BCR_Case_URL__c = 'http://cases.boxerproperty.com/ViewCase.aspx?CaseID='+ c.BCR_Case_Id__c;

    Update CList;


The error is "Callout from triggers are currently not supported".


1 Answer 1


Callouts was never allowed in Salesforce after DML operation (and since trigger is running thhere was some): https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_timeouts.htm?search_text=callout

The way to work with this is using @future annotation: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_future.htm

which bascially send request asynchronously

  • Thanks for Help. Actually I wrote a script of REST API and now I want to insert response of rest API in contract object (Fx. getting case Return ID and I want to insert it in my contract object )
    – Jerry
    Oct 26, 2016 at 15:32

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