'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?

1 Answer 1


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' Commented Feb 20, 2017 at 7:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .