Salesforce 如何在LWC组件中从apex查询中导出picklist值
我的要求是从LWC组件中Salesforce中apex查询返回的列表中设置一个默认的选择列表值Salesforce 如何在LWC组件中从apex查询中导出picklist值,salesforce,lwc,lightning,Salesforce,Lwc,Lightning,我的要求是从LWC组件中Salesforce中apex查询返回的列表中设置一个默认的选择列表值 wire(getCompanyActiveProducts) products({ data }) { if (data) { const comboboxOptions = data.map((code) => { const PrdName = code.Name.substring( code.Name.indexOf("
wire(getCompanyActiveProducts)
products({ data }) {
if (data) {
const comboboxOptions = data.map((code) => {
const PrdName = code.Name.substring(
code.Name.indexOf("-") + 2
);
return {
label: `${`${code.Name} (${isoLabel})`}`,
value: code.Name
};
});
顶点类
return [
SELECT Name, Id, IsActive FROM Product2 WHERE IsActive = TRUE
];
LWC组件
wire(getCompanyActiveProducts)
products({ data }) {
if (data) {
const comboboxOptions = data.map((code) => {
const PrdName = code.Name.substring(
code.Name.indexOf("-") + 2
);
return {
label: `${`${code.Name} (${isoLabel})`}`,
value: code.Name
};
});
在上面的组件中,我想检查产品“硬件”是否可用,如果可用,则将其设为默认值