You need to sign in to do that
Don't have an account?
roni shore
Unable to add records to list <AccountContactRelation>
Compile Error: Invalid type: AccountContactRelation
when adding record in list in last line, it throws error, pls suggest
List<AccountContactRelation> lstACR = new List<AccountContactRelation>();// error here
for(AccountContactRelation ACR : [Select Id, AccountId, ContactId, Roles from AccountContactRelation where ContactId =: sConId and
AccountId in : accIds and Roles in : mapConRole.values()]) {
if(ACR.AccountId == opp.Ship__c)
bShip = true;
if(ACR.AccountId == opp.Bill__c)
bBill = true;
}
if(!bFoundShip)
lstACR.add(new AccountContactRelation(AccountId = opp.Ship__c, ContactId = sConId, Roles = sConRole));
when adding record in list in last line, it throws error, pls suggest
List<AccountContactRelation> lstACR = new List<AccountContactRelation>();// error here
for(AccountContactRelation ACR : [Select Id, AccountId, ContactId, Roles from AccountContactRelation where ContactId =: sConId and
AccountId in : accIds and Roles in : mapConRole.values()]) {
if(ACR.AccountId == opp.Ship__c)
bShip = true;
if(ACR.AccountId == opp.Bill__c)
bBill = true;
}
if(!bFoundShip)
lstACR.add(new AccountContactRelation(AccountId = opp.Ship__c, ContactId = sConId, Roles = sConRole));
All Answers
Make sure that you enabled Allow users to relate a contact to multiple company checkbox in Account Settings.
Thanks,
Sowmya.