+ Start a Discussion
Rom_Rom_ 

Error deploying apex trigger to production

Trying to deploy this trigger to production. Received following error message:
 Methods defined as TestMethod do not support Web service callouts 
Stack Trace: null

 
trigger updateOppField on Account(before insert, before update){
     for(Account acc : trigger.new){
         if(acc.Text_ID__c != null){
             acc.A_Opportunity__c = acc.Text_ID__c;
         }
     }
 }
Any ideas/solutions will be greatly appreciated.

 
Shashi PatowaryShashi Patowary
Hi,

In one of the test classes, you are trying to call a method that is actually calling a Webservices.Please rewrite the test class to do a mock callout.

You can find an example of doing this at this link -

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm

Please let me know if this is helpful.

regards,
Shashi
Abhishek BansalAbhishek Bansal
Hi,

It seems like you are including a test class in your change set and in that test class you are trying to make a web service callout that is not supported by Salesforce.
This trigger does not have any error.
The issue here is with your test class which you need to fix.
You can get the help from below link to make your test class run correctly :
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_wsdl2apex_testing.htm

Let me know if you need more help or information on this.

Thanks,
Abhishek
Ezdhan Hussain S KEzdhan Hussain S K
Hello Rom,
Callouts are not supported in test methods. To test callouts you need to develop Mock requests and response.

Refer below link for more help

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_wsdl2apex_testing.htm (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_wsdl2apex_testing.htm" target="_blank)

If that helps mark it as best Answer. Cheers..!