Activity › Forums › Salesforce® Discussions › What is Dynamic Binding in Salesforce?
Tagged: Account Name, Compile Time, Contact, Dynamic Binding, Dynamic Visualforce Binding, Runtime Execution, Salesforce Visualforce, Static Binding, Visualforce pages
-
What is Dynamic Binding in Salesforce?
Posted by Aman on September 22, 2018 at 9:49 PMWhat is Dynamic Binding in Salesforce?
Parul replied 7 years, 7 months ago 3 Members · 2 Replies -
2 Replies
-
Dynamic Visualforce bindings are a way of writing generic Visualforce pages that display information about records without necessarily knowing which fields to show. In other words, fields on the page are determined at run time, rather than compile time. This allows a developer to design a single page that renders differently for various audiences, based on their permissions or preferences. Dynamic bindings are useful for Visualforce pages included in managed packages since they allow for the presentation of data specific to each subscriber with very little coding.
Example 1:
Access the Account name from Contact.
{!myContact[‘Account’][fieldname]}Example 2:
Consider Data type in Apex
public Map<String, List<Account>> accountsMap {get; set;}
Visualforce page:<apex:variable value=”A” var=”selectedKey” />
<apex:pageBlockTable value=”{!accountsMap[selectedKey]}” var=”acc”>
<apex:column value=”{!acc.name}”/>
<apex:column value=”{!acc.BillingStreet}”/>
<apex:column value=”{!acc.BillingCity}”/>
<apex:column value=”{!acc.BillingPostalCode}”/>
</apex:pageBlockTable> - [adinserter block='9']
-
Dynamic Visualforce Bindings means fields on the page are determined at run time, rather than compile time.
Use them on a page like this:{!reference[expression]}
Static Bindings means fields on the page are determined at compile time.
Log In to reply.