You need to sign in to do that
Don't have an account?
Raghu.2020
Display object fields and their datatype in Aura
Hi,
I have requirement to search for an object and then display their related field names and field datatype using aura. Can anyone help me with this.
Thanks
I have requirement to search for an object and then display their related field names and field datatype using aura. Can anyone help me with this.
Thanks
Below is the piece of Apex code which would return you the given object's Field Names and their Data Types:
This example is for 'Account' object, you can verify the result by running above code directly into developer console using Anonymous window.
Once you have the results ready in your Apex(in variable fieldLabel & fielddataType), you can display the results into your Aura components the way you want, may be in a fancy way too..
You can find example on how to write an Aura component to display values retrieved in Apex on below link:
https://developer.salesforce.com/forums/?id=9062I000000Xm5DQAS
Reference:
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_Schema_DisplayType.htm
Hope above information helps, Please mark as Best Answer so that it can help others in the future.
Thanks.
Thanks for your reply. I'm facing difficulty showing them in a datatable since the examples you provided were discussing about object which will have key value as Id. But in my case, I have two lists of strings and not sure how to return both and display them in datatable.