Salesforce accountCreator.js文件中sobjectField类型的引用Account.BillingCountryCode无效
我尝试获取salesforce默认字段,但失败。 错误消息为: 强制应用程序/main/default/lwc/accountCreator/accountCreator.js无效 参考文件中sobjectField类型的Account.BillingCountryCode accountCreator.js 我的代码在这里:Salesforce accountCreator.js文件中sobjectField类型的引用Account.BillingCountryCode无效,salesforce,salesforce-lightning,lwc,Salesforce,Salesforce Lightning,Lwc,我尝试获取salesforce默认字段,但失败。 错误消息为: 强制应用程序/main/default/lwc/accountCreator/accountCreator.js无效 参考文件中sobjectField类型的Account.BillingCountryCode accountCreator.js 我的代码在这里: import { LightningElement, wire, api } from 'lwc'; import { getRecord, getFieldValue
import { LightningElement, wire, api } from 'lwc';
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
import NAME_FIELD from '@salesforce/schema/Account.Name';
import ParentId_FIELD from '@salesforce/schema/Account.ParentId';
import BillingCountryCode_FIELD from '@salesforce/schema/Account.BillingCountryCode';
import BillingCountry_FIELD from '@salesforce/schema/Account.BillingCountry';
const fields = [NAME_FIELD, ParentId_FIELD, BillingCountry_FIELD, BillingCountryCode_FIELD];
export default class AccountCreator extends LightningElement {
@api recordId;
@wire(getRecord, { recordId: '$recordId', fields })
account;
get name() {
return getFieldValue(this.account.data, NAME_FIELD);
}
get parentId() {
return getFieldValue(this.account.data, ParentId_FIELD);
}
get countryCode() {
return getFieldValue(this.account.data, BillingCountryCode_FIELD);
}
get country() {
return getFieldValue(this.account.data, BillingCountry_FIELD);
}
connectedCallback() {
console.log('recordId==', this.recordId, ' ACCOUNT_OBJECT==', ...ACCOUNT_OBJECT);
}
}
您的组织是否启用了州和国家/地区选择列表?是的,我在几天前按照您的建议启用了“州和国家/地区选择列表”,并且成功了,但今天它不成功,我再次转到安装程序进行检查,“州和国家/地区选择列表”仍然处于启用状态,您知道为什么吗?