Hey guys, today in this post we are going to learn about How to Get Billing Address of Account Object from Quote based on record Id using Apex Class Method in Visualforce Page Salesforce.
Address is a “compound field” – in simple terms, this means the field groups together multiple individual elements into a single compound.
Custom Address Fields:- Users can populate a custom address fields manually or they can use the Google lookup to search for an address. Admins and APIs can access each address stored in a custom address field as a structured compound data type as well as individual address components. To know more details about Address field in Salesforce, Click Here.
Final Output →
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 : accAddressFromQuoteVf.vfp
From Developer Console >> File >> New >> Visualforce Page
accAddressFromQuoteVf.vfp [Visualforce Page]
<apex:page standardController="Quote" extensions="accAddressFromQuoteVfCtrl">
<div class="slds slds-p-around_small" style="padding:10px;">
<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;">
<tr style="background:#ddd;">
<th>Quote Name</th>
<th>Billing Street</th>
<th>Billing City</th>
<th>Billing Country</th>
<th>Billing Postal Code</th>
</tr>
<apex:repeat value="{!quoteObj}" var="qotItem">
<tr>
<td><p><apex:outputText value="{!qotItem.Name}"/></p></td>
<td><p><apex:outputText value="{!qotItem.Account.BillingStreet}"/></p></td>
<td><p><apex:outputText value="{!qotItem.Account.BillingCity}"/></p></td>
<td><p><apex:outputText value="{!qotItem.Account.BillingCountry}"/></p></td>
<td><p><apex:outputText value="{!qotItem.Account.BillingPostalCode}"/></p></td>
</tr>
</apex:repeat>
</table>
</div>
</apex:page>
Create Apex Class Extension Controller in Visualforce
Step 2:- Create Apex Class : accAddressFromQuoteVfCtrl.apxc
From Developer Console >> File >> New >> Apex Class
accAddressFromQuoteVfCtrl.apxc [Apex Class Controller]
public class accAddressFromQuoteVfCtrl {
public String MstrId{GET;SET;}
public Quote quoteObj{GET;SET;}
public accAddressFromQuoteVfCtrl(ApexPages.StandardController Controller){
MstrId = ApexPages.currentPage().getParameters().get('id');
quoteObj = [SELECT Id, Name, AccountId, Account.Name, Account.BillingStreet, Account.BillingCity, Account.BillingCountry, Account.BillingPostalCode FROM Quote WHERE Id=:MstrId ];
}
}
Further post that would you like to learn in Salesforce
How do I display a Visualforce page in Salesforce?
From Setup, enter Visualforce Pages in the Quick Find box, then select Visualforce Pages and click the name of a Visualforce page to view its details, including when it was created, when it was last modified, and the Visualforce markup associated with the page.
Where can you display Visualforce pages?
From Setup, enter Visualforce Pages in the Quick Find box, then select Visualforce Pages to display the Pages list page, which shows all the Visualforce pages defined for your organization.
How do I Preview VF component?
From Setup, enter Components in the Quick Find box, then select Visualforce Components and click the name of a custom component to view its definition. From the detail page, you can do any of the following: Click Edit to edit the custom component.
Related Topics | You May Also Like
Our Free Courses →
👉 Get Free Course →
📌 Salesforce Administrators 📌 Salesforce Lightning Flow Builder 📌 Salesforce Record Trigger Flow Builder |
👉 Get Free Course →
📌 Aura Lightning Framework 📌 Lightning Web Component (LWC) 📌 Rest APIs Integration |