You need to sign in to do that
Don't have an account?
kryan0618
Select Opportunity Contact Role Mailing State Code
Hi,
I am trying to modify APEX code which pulls Contact Mailing information because we have enabled the State/Country Picklist processing. I get an error message the Code field does not exist??
Example APEX code:
List<OpportunityContactRole> ocrs = [select ContactId, Contact.AccountId, Contact.Email, Contact.Phone, Contact.Fax, Contact.MailingCity, Contact.MailingCountry, Contact.MailingPostalCode, Contact.MailingStateCode, Contact.MailingStreet, Contact.Name, Id, Role, Opportunity.AccountId, OpportunityId from OpportunityContactRole where opportunityId in :Oppties and role in ('Billing Contact','Shipping Contact')];
All documentation I see says I should be using 'MailingStateCode' to pull the data I want.
This is the error message I receive:
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger OpportunityBillingContactInfo caused an unexpected exception, contact your administrator: OpportunityBillingContactInfo: execution of BeforeUpdate caused by: System.QueryException: No such column 'MailingStateCode' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.: Class.opportunityHandler.opptyBillingContactInfoHandler: line 9, column 1
Thoughts??
I am trying to modify APEX code which pulls Contact Mailing information because we have enabled the State/Country Picklist processing. I get an error message the Code field does not exist??
Example APEX code:
List<OpportunityContactRole> ocrs = [select ContactId, Contact.AccountId, Contact.Email, Contact.Phone, Contact.Fax, Contact.MailingCity, Contact.MailingCountry, Contact.MailingPostalCode, Contact.MailingStateCode, Contact.MailingStreet, Contact.Name, Id, Role, Opportunity.AccountId, OpportunityId from OpportunityContactRole where opportunityId in :Oppties and role in ('Billing Contact','Shipping Contact')];
All documentation I see says I should be using 'MailingStateCode' to pull the data I want.
This is the error message I receive:
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger OpportunityBillingContactInfo caused an unexpected exception, contact your administrator: OpportunityBillingContactInfo: execution of BeforeUpdate caused by: System.QueryException: No such column 'MailingStateCode' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.: Class.opportunityHandler.opptyBillingContactInfoHandler: line 9, column 1
Thoughts??
Let me know if you still have questions ~