Site icon Salesforce News Technology Stuff

Display Generic sObject in Lightning

 

In the last post we study how we can iterate map in Lightning. There is one more thing which we face many time is dynamic field binding. Visualforce wit dynamic field binding we can dynamically create field instance but in lightning this is a major limitation.

Today we will see how we can use dynamic sObject binding in visualforce. For this we will create a sample component to display dynamic fields.

Here we will create app to get Object details. for demo I have select Account object we can select any object here. We can also select any fields here including the parent fields(cross reference field).

Now we will pass the object and field name in another component. Where we will display them on UI.

So here we are using JavaScript to to get data from the field. This is similar of what we have done in Map Iteration post.

To display on UI I am using lightning:formattedText we can also use any other component as well.

You can find the complete code here as well.

DO you want to add anything let me know in comments section. Happy programming 🙂

Exit mobile version