You need to sign in to do that
Don't have an account?
kevohara
Problem with Lead.sObjectType
I am trying to develop a VF controller extension that works with Leads and Opportunities. In my constructor I am checking the sObjectType of the standard controller then handling everything else according to whether its a Lead or an Opportunity. For some reason, I am getting an "invalid field Lead.sObjectType" error when saving in the IDE. I get no such error with the Opportunity.sObjectType. How is this possible?
public class EventsController { private final Lead lead; private final Opportunity opp; public EventsController(ApexPages.StandardController controller) { sObject record = controller.getRecord(); Schema.sObjectType objType = record.getSObjectType(); if(objType == Lead.sObjectType) { //Process the lead } else if (objType == Opportunity.sObjectType) { //Process the opportunity } } }
Again, only the Lead.sObjectType is giving me problems. I tested it with only the Opportunity.sObjectType and it works fine.
Any suggestions?
It's the case insensitivy doing a figure eight, try mylead instead of lead...
All Answers
It's the case insensitivy doing a figure eight, try mylead instead of lead...
D'oh!
How insensitive of Apex to do that to me!