function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Smurfet15Smurfet15 

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

Hi,

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, 
Opportunity__r.PR_Approval_level__c, 
Opportunity__r.Bill_To_Contact__r.FirstName, 
Opportunity__r.Bill_To_Contact__r.LastName 
FROM Case WHERE Id = '500M0000006Acvv'

Thanks in advance,
Mary 
 
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