You need to sign in to do that
Don't have an account?

Get Contact Role in SOQL query
Salute.
I'm trying to add to the contact list page an indication of the role of each indirect contact. Like this:
public List<Contact> Contacts { get{ return [SELECT Id, Name, Account.Name, Title, Email, Phone, Relations__c FROM Contact LIMIT 1000]; } set;} public List<Role> Roles { get{ return [SELECT Role FROM AccountContactRoles]; } set;} I tried adding Role or AccountContactRole fields, but they are not recognized. What I need to do?I tried to indicate the Role field in the first request, but received a recognition error (which is logical, there is no such field in the standard contact card).
Then I made the second request only for roles, but it also produces Compile Error: Invalid type: Roles.
What i need to do?
Try the following SOQL query:
Regards
can you try this
SELECT Id, Name, Account.Name, Title, Email, Phone, Relations__c, (select role from AccountContactRoles) FROM Contact LIMIT 1000 ?
Regards
<apex: column value = "{! contact.Role}"/> fails in all interpretations.
did you try something like {!contact.AccountContactRoles.Role} ?
Regards
For an unclear reason, a direct reference to a Role via ACR did not help either.
In the end, I decided simply through the custom field for the contact, to which I connected the value ACR.Roles in the controller.