function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Krishnam76Krishnam76 

Error message - Callout from triggers are currently not supported.

Hi there,

I generated an APEX class from the following WSDL file - http://sdpws.strikeiron.com/sdpZIPCodeInfo?WSDL from strikeiron.

I then created the following APEX Trigger -

trigger UpdateCounty on Lead (before insert, before update)
{
        for (Lead lead: System.Trigger.new) {
               if (lead.County__c == null){
               wwwStrikeironCom.SDPZipCodesSoap oZipCodeLookup = new wwwStrikeironCom.SDPZipCodesSoap();
               oZipCodeLookup.LicenseInfo = new wsStrikeironCom.LicenseInfo();
               oZipCodeLookup.LicenseInfo.RegisteredUser = new wsStrikeironCom.RegisteredUser();
               oZipCodeLookup.LicenseInfo.RegisteredUser.UserID = 'sanand@kbb.com';
               oZipCodeLookup.LicenseInfo.RegisteredUser.Password = 'sumajee76';
               wwwStrikeironCom.ZipCodeOutput oLookupResult = oZipCodeLookup.GetZipCode(lead.County__c);
               lead.County__c = oLookupResult.ServiceResult.ZipCodes.ZipCodeInfo[1].County;
              
               }
        }
}

I need to be able to automatically populate the COUNTY field under LEADS object based off the info the user enters in the web-to-lead form. That means, the zipcode should be captured and based off this COUNTY field should be updated or filled in the LEADS form.

When I create the new LEAD and enter zipcode - hoping that when this record is saved I would see the COUNTY field uploaded - it gives me this error message;-

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Force.com Sandbox

 

Apex script unhandled trigger exception by user/organization: 005300000010lx0/00DT0000000F6LV

 

UpdateCounty: execution of BeforeInsert

 

caused by: System.CalloutException: Callout from triggers are currently not supported.

 

Class.wwwStrikeironCom.SDPZipCodesSoap.GetZipCode: line 94, column 13

Trigger.UpdateCounty: line 10, column 63

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Any ideas?

Thanks
Sai LavuSai Lavu

Callouts are not supported at this stage. Ways you can handle this:

1. You can have a button called lookup county which will update the field...you already knew that!

2. If you don't need to store the county then you can have a mashup.

3. Haven't tried this but you try overriding the view button so that you update the county if it is blank and if the zip code exists. Won't work for records entered via API.

4. You can create a poller which will update this data in the background every so often.

5. If you lookup a zip code once keep a local copy of the corresponding county in a custom object and try looking it up there first.

SFDC has come up @future annotation (Asynchronous Apex) as dev preview in Summer 08 which may tackle this.

valentinoromelivalentinoromeli

Hi there,

I've the same problem.

Are there any alternative ways to bypass this problem?

When an account is being updated I would like a function within a web service to be called so this account in our local database is being updated to.

Is it then possible to call a function in a web service implemented within Salesforce which is doing the call out to my local web service?

Thx in advance!