You need to sign in to do that
Don't have an account?
how to create a picklist for pricebook records in aura component. i want to display PriceBook Records as a picklist in AuraComponent, Can any one help me, i am a Beginner.
Controller apex:
public class newPriceBookEntry {
@AuraEnabled
public static List<Pricebook2> getAllPricebooks() {
return [SELECT Id, Name FROM Pricebook2];
}
}
Component::
<aura:attribute name="PriceBooks" type="List" default="[]"/>
<aura:handler name="init" value="{! this }" action="{! c.init }"/>
<div class="slds-m-around_xx-large">
<lightning:combobox name="general" label="Many Options" placeholder="Select an PriceBook"
options="{!v.PriceBooks }" onchange="{! c.handleChange }"/>
</div>
Controller:JS::
init : function(component, event, helper) {
var items = component.get("c.getAllPricebooks");
var Options = [{ value: "v.PriceBooks", label: items }];
component.set("v.PriceBooks", Options);
},
Hii Dastagiri
try below Code
Please Mark It As Best Answer If It Helps
Thank You!
All Answers
Hii Dastagiri
try below Code
Please Mark It As Best Answer If It Helps
Thank You!