You need to sign in to do that
Don't have an account?
Semira@gmail.com
System.SObjectException: Invalid field
Hi friends,
I'm recieving this error message and don't know why it is an invalid field. Can someone please help me?
The last line CM assignment is giving me the error. Why is this an invalid field?
I'm recieving this error message and don't know why it is an invalid field. Can someone please help me?
//fetch ContactID from opportunity in a set<ID> ContactID if(!ContactID.isempty()) { CampMember = new list<CampaignMember>([Select Id, CampaignID From CampaignMember where contactid IN: ContactID]); } CampaignMember CM = new CampaignMember(); if(opportunity.contact__c != null) { CM = (CampaignMember)CampMember[0].get(opportunity.contact__c); }
The last line CM assignment is giving me the error. Why is this an invalid field?
Take different set name like
set<Id> contactIds;
if(contactIds.size()>0)
{
\\ query contactId field
CampMember = new list<CampaignMember>([Select Id, CampaignID,contactId From CampaignMemberwhere contactid IN: ContactID]);
}
if(opportunity.contact__c != null)
{
for(CampaignMember c:campMember)
{
CampaignMember CM = new CampaignMember();
if(opportunity.contat__c == c.contactId){ CM = c;}
}
This class is written for a trigger. My trigger is calling the class and assigning a list of opportunity.