2

Similar to how we define type for properties in targetconfigs as:

<property name="strTitle" type="String" default="Welcome in Salesforce" label="Enter the title"/>
<property name="showImage" type="Boolean" default="true" label="Show Image ?"/>
<property name="imgUrl" type="String" default="" label="Enter Image URL"/>

I have a property which stores data returned from apex of type list. So, what type value should I specify for such property?

I couldn't locate anything is documentation that could've helped.

1 Answer 1

0

You can return values from apex provided you are rendering it as the picklist value.

<property label="Name" name="name" type="String" datasource="apex://MyCustomPickList

Take a look into the documentation shown below on how to implement class MyCustomPickList

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_config_for_app_builder_dynamic_picklists.htm

If you are using with the flow then the approach is different and discussed in the docs here

<property name="backgroundColor" type="apex://namespace.Classname”>
5
  • I'm rendering the data on the lightning-datatable.. I return an instance of type wrapper(object for js) which contains multiple lists of another wrapper type.. Why I'm really checking this is because I want to use my component on Community and it wasn't working there. What I figured from a few google search results was the I need to define all the properties in the xml targetConfigs.. Do I need to specify every single property that I've in the js? because I've multiple of those and it's a pretty complicated js file.
    – sfdcnoob
    Aug 10, 2020 at 17:36
  • If you have an apex wrapper then you need not add eveyrhting! Aug 10, 2020 at 17:37
  • I'm not talking about wrapper variables/properties.. I'm talking about the different lists that I create from the returned wrapper in js.. and also the different boolean and other properties declared only in js.. Whatever is declared in js.. that needs to added to targetconfigs.. right?
    – sfdcnoob
    Aug 10, 2020 at 18:44
  • @sfdcnoob yes those needs to be exposed but I don't think it is supported at this point except if you are building your component for flow use case. Aug 10, 2020 at 19:26
  • I'm not using it for flow use case.. I just need to add my component to community cloud. Could you please confirm what type I'd need to specify in the property for a list of object in such case and I'll close this thread and mark you answer as accepted.
    – sfdcnoob
    Aug 11, 2020 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.