'Sales Rep' is one of the Role in my org. I want to create a custom view in which I can see 'only' cases assigned to 'Sales Rep' role strictly using Salesforce visualforce and Controller. How to check 'Cases Assigned to specifice Role' using SOQL?


You can use Owner.UserRole.Name as a filter, as in:

SELECT ... FROM Case WHERE Owner.UserRole.Name = 'Sales Rep'
  • Yes it worked. select CaseNumber,OwnerId from case where Owner.UserRole.Name = 'Sales Rep' Feb 20 '17 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.