How to find Quote owner manager’s Name and Email using apex soql query in Visualforce Salesforce | How to Get Lookup manager Name/Email from User object in Visualforce Page | How to access Owner’s Manager Email/Name fields in a SOQL query Salesforce

318 views

Hey guys, today in this post we are going to learn about How to find Quote owner’s manager’s Name and Email using apex soql query in Visualforce Salesforce.

 

Visualforce is a web development framework that enables developers to build sophisticated, custom user interfaces for mobile and desktop apps that can be hosted on the Lightning Platform. You can use Visualforce to build apps that align with the styling of Lightning Experience, as well as your own completely custom interface. To Know more details, Click Here.

 

Final Output β†’

how to get manager name from quote in visualforce page -- w3web.net

 

You can download file directly from github by Click Here.

 

Other related post that would you like to learn in Salesforce

 

  • Find the below steps β–Ύ

 

Create Visualforce Page

Step 1:- Create Visualforce Page : ownerManagerFromQuoteVf.vfp

From Developer Console >> File >> New >> Visualforce Page

ownerManagerFromQuoteVf.vfp [Visualforce Page]

  1.    <apex:page standardController="Quote" extensions="ownerManagerFromQuoteVfCtrl">
  2.     <div class="slds" style="padding:10px;">
  3.         <p style="font-size:16px; display:block; margin-bottom:15px; color:#008ee8;">
  4.             Find Owner's <strong>Manager name</strong> from Quote
  5.         </p>
  6.         <br/>
  7.          <table width="50%" border="1" cellspacing="0" cellpadding="5" bordercolor="#ccc" class="slds-table slds-table_bordered slds-table_col-bordered" style="border-collapse:collapse;">
  8.             <tr style="background:#eee;">
  9.                 <th>Owner Name</th>
  10.                 <th>Manager Name</th>
  11.                 <th>Manager Email</th>
  12.             </tr> 
  13.             <apex:repeat value="{!quoteObj}" var="qItm">               
  14.                     <tr>
  15.                         <td><apex:outputField value="{!qItm.Owner.Name}"/></td>
  16.                         <td><apex:outputText value="{!managerName}"/></td>
  17.                         <td><apex:outputText value="{!managerEmail}"/></td>
  18.                     </tr>               
  19.            </apex:repeat>
  20.        </table>           
  21.     </div>
  22. </apex:page>

 

Create Apex Class Extension Controller in Visualforce

Step 2:- Create Apex Class : ownerManagerFromQuoteVfCtrl.apxc

 
βœͺ The Big Announcement: -
As per student's demands, I re-opened my eBook of "Salesforce Tutorial" Limited-time huge discount offer Absolutely 50% Off.
I am thinking to give you discount offer occasion of Gandhi Jayanti for a powerful "Salesforce admin course" where you can Understand from Basic Concepts to advanced label in Salesforce.
πŸ‘‰ So Don't MISS it... (Access Right Now)
πŸ‘‰ Get Huge Discount Offer 50%: - Get eBook
 

From Developer Console >> File >> New >> Apex Class

ownerManagerFromQuoteVfCtrl.apxc [Apex Class Controller]

  1.   public class ownerManagerFromQuoteVfCtrl {
  2.  
  3.     public String MstrId{GET;SET;}
  4.     public Quote quoteObj{GET;SET;}
  5.     public USER userObj{GET;SET;}
  6.     public USER userMngrId{GET;SET;}
  7.     public String managerName{GET;SET;}
  8.     public String managerEmail{GET;SET;}
  9.     public ownerManagerFromQuoteVfCtrl(ApexPages.StandardController Controller){       
  10.         MstrId = ApexPages.currentPage().getParameters().get('id');
  11.         quoteObj = [SELECT Id, Name, OwnerId, Owner.Name FROM Quote WHERE Id=:MstrId ];
  12.  
  13.         userObj= [SELECT id, Name, Manager.id, ManagerId FROM USER WHERE id=:quoteObj.OwnerId];
  14.         system.debug('userObj## ' + userObj);
  15.  
  16.         IF(userObj.ManagerId !=NULL || userObj.ManagerId ==''){
  17.             userMngrId= [SELECT id, Name, Email, ManagerId FROM USER WHERE id=:userObj.Manager.id];
  18.             managerName = userMngrId.Name;
  19.             managerEmail = userMngrId.Email;
  20.             system.debug('userMngrId#' + userMngrId) ;
  21.         }
  22.  
  23.  
  24.  
  25.     }
  26.  
  27. }

 
get manager name from quote in visualforce -- w3web.net
 

Further post that would you like to learn in Salesforce

 

 

 

How do I query a Quote owner in Salesforce?

Just use Owner.name in the select of your soql. This should give you the owner name.

How do I run a SOQL query in Visual Studio?

To execute SOQL you can simply select the text and run the command SFDX: Execute SOQL Query with Currently Selected Text . You can choose to execute your query against the REST or Tooling APIs. After the query is executed the results display in the output pane.

How do I find the owner of a role in Salesforce?

Click on Setup. In the Quick Find box, enter Roles then click Roles. Click Edit next to the Role Name.

Related Topics | You May Also Like

 
   
 
 

Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

Leave a Comment