+ Start a Discussion

SOQL query to get username from the case object and userid is in the opportunity object


I have query that need to pull the Username from Users table but I am currently on Case object and the user ID is in opportunity.
This is working, but I want to show Approval name instead of user id (Opportunity__r.PR_Approval_level__c).  This should be the setup Master is Case Object.

Can you please help me?
SELECT Account_Owner__c, CaseNumber, 
FROM Case WHERE Id = '500M0000006Acvv'

Thanks in advance,
Niket SFNiket SF
If you have relationship between Case and Opportunity you can do this. Out of the box I am not sure we have relationship between Case and Opportunity.

- If you hace custom relatioship between Opportunity and Case use relationship name insted of "Opportunity__r".

 All the best