You need to sign in to do that
Don't have an account?
sowmya thotthadi
AccountContactOppurtunitycon Compile Error: Variable does not exist: id at line 10 column 32
public class AccountContactOppurtunitycon {
public AccountContactOppurtunitycon()
{
accountid = new set<id>();
for(OpportunityContactRole contactRole : [select ContactId , Contact.Name, opportunityId ,opportunity.Name ,opportunity.Amount, opportunity.Account.Name,Opportunity.AccountId from OpportunityContactRole]){
accountid.add(ContactRole.Opportunity.AccountId);
for(id idrecord :accountid){
InnerClass ic=new InnerClass();
ic.opporidtunityList = id;
}
}
}
public class InnerClass{
Public opportunity opportunityList{get; set;}
Public list<OpportunityContactRole> contactRole{get;set;}
}
public AccountContactOppurtunitycon()
{
accountid = new set<id>();
for(OpportunityContactRole contactRole : [select ContactId , Contact.Name, opportunityId ,opportunity.Name ,opportunity.Amount, opportunity.Account.Name,Opportunity.AccountId from OpportunityContactRole]){
accountid.add(ContactRole.Opportunity.AccountId);
for(id idrecord :accountid){
InnerClass ic=new InnerClass();
ic.opporidtunityList = id;
}
}
}
public class InnerClass{
Public opportunity opportunityList{get; set;}
Public list<OpportunityContactRole> contactRole{get;set;}
}
we are gettting error with this line " ic.opporidtunityList = id;" replace that line with " ic.opporidtunityList = idrecord;" because here "idrecord" is variable and one more thing declare set properly Like set<id> accountid = new set<id>()'
Please Let me Known we have any queries.
accountid.add(ContactRole.Opportunity.AccountId);
for(id idrecord :accountid){
InnerClass ic=new InnerClass();
ic.opportunityList= idrecord.;
}
{
accountid = new set<id>();
List<InnerClass> innerclassList = new List<InnerClass>();
for(OpportunityContactRole contactRole : [select ContactId , Contact.Name, opportunityId ,opportunity.Name ,opportunity.Amount, opportunity.Account.Name,Opportunity.AccountId from OpportunityContactRole]){
accountid.add(ContactRole.Opportunity.AccountId);
}
for(id idrecord :accountid){
InnerClass ic=new InnerClass(idrecord);
innerclassList.add(ic);
}
}
public class InnerClass{
Public id opportunityId{get; set;}
Public list<OpportunityContactRole> contactRole{get;set;}
public InnerClass(Id opprecordId){
opportunityId = opprecordId ;
}
}
Map<id,List<OpportunityContactRole>> accountid ;
public AccountContactOppurtunitycon()
{
accountid = new Map<id,List<OpportunityContactRole>>();
List<InnerClass> innerclassList = new List<InnerClass>();
for(OpportunityContactRole contactRole : [select ContactId , Contact.Name, opportunityId ,opportunity.Name ,opportunity.Amount, opportunity.Account.Name,Opportunity.AccountId from OpportunityContactRole]){
if(!accountid.containskey(ContactRole.Opportunity.AccountId)) {
accountid.put(ContactRole.Opportunity.AccountId,new List{ContactRole});
}
else{
accountid.get(ContactRole.Opportunity.AccountId).add(ContactRole);
}
}
}
Map<id,List<OpportunityContactRole>> accountid ;
public AccountContactOppurtunitycon()
{
accountid = new Map<id,List<OpportunityContactRole>>();
for(OpportunityContactRole contactRole : [select ContactId , Contact.Name, opportunityId ,opportunity.Name ,opportunity.Amount, opportunity.Account.Name,Opportunity.AccountId from OpportunityContactRole]){
if(!accountid.containskey(ContactRole.Opportunity.AccountId)) {
accountid.put(ContactRole.Opportunity.AccountId,new List<OpportunityContactRole>{ContactRole});
}
else{
accountid.get(ContactRole.Opportunity.AccountId).add(ContactRole);
}
}
}
}
Given code is of 17 lines. How the error is at 27..? If you have added something to this code, then you must post code as well. Also you should ask question about what you want (what is you requirement/end result) and what help you need.
public AccountContactOppurtunitycon() {
accountid = new set<id>();
List<InnerClass> innerclassList = new List<InnerClass>();
for(OpportunityContactRole contactRole : [select ContactId , Contact.Name, opportunityId ,opportunity.Name ,opportunity.Amount, opportunity.Account.Name,Opportunity.AccountId from OpportunityContactRole]){
accountid.add(ContactRole.Opportunity.AccountId);
}
for(id idrecord :accountid){
InnerClass ic=new InnerClass(idrecord);
innerclassList.add(ic);
System.debug('@@@@'+innerclassList);
{
}
}
}
public class InnerClass{
Public id opportunityId{get; set;}
Public list<OpportunityContactRole> contactRole{get;set;}
public InnerClass(Id opprecordId , ContactId contact){
opportunityId = opprecordId ;
contactRole = contact ;
}
}