You need to sign in to do that
Don't have an account?
Gonzalo Quevedo 15
Using {!v.objectName} in Lightning component Design file
Hi!
I am working in a lighning component. This component will be displayed in lightning app builder interface, so users will be able to put it in ANY object record page.
I use some attributes (for component configuration) in the design file. Some of them are picklist that I populate in an apex class. This picklist values should change depending on the object that use my component. Is there any way to know in which object the component is running? I know I can use {!v.objectName} in component markup but I don't know if is possible to do something similar at design file or the apex class that I use to show my custom picklist values for my picklist attribute.
Thanks! :)
I am working in a lighning component. This component will be displayed in lightning app builder interface, so users will be able to put it in ANY object record page.
I use some attributes (for component configuration) in the design file. Some of them are picklist that I populate in an apex class. This picklist values should change depending on the object that use my component. Is there any way to know in which object the component is running? I know I can use {!v.objectName} in component markup but I don't know if is possible to do something similar at design file or the apex class that I use to show my custom picklist values for my picklist attribute.
Thanks! :)
I resolve my problem with this: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_VisualEditor_DesignTimePageContext.htm#apex_class_VisualEditor_DesignTimePageContext
Very handy! .
All Answers
There is a new great new project with a technique using the metadata for components working for any object:
Build Reusable Lightning Components:
Build Lightning components for any object, with the help of custom metadata and Apex: Prepare to Be Object-Agnostic
https://trailhead.salesforce.com/en/projects/build-reusable-lightning-components
I resolve my problem with this: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_VisualEditor_DesignTimePageContext.htm#apex_class_VisualEditor_DesignTimePageContext
Very handy! .