- 画面フローにlwcを入れている。
- lwcに画面フローへの出力がある。
lwc.js-meta.xml
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>67.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>xx</masterLabel>
<description>xx</description>
<targets>
<target>lightning__FlowScreen</target>
<target>lightning__AppPage</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__FlowScreen">
<property name="xxxOut" type="apex://XxxType" label="アウトプット" role="outputOnly" description="See apex XxxType"/>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
XxxType.cls
/**
* Order__c に Date型のカスタム項目 mDate__c がある
*/
public with sharing class XxxType {
@AuraEnabled public Order__c orderToUpdate { get; set; } // 更新対象ー注文ヘッダ
}
掲題のエラーが起き得る実装:
lwc.js
let shippingDate = (this.shippingDate || "").trim();
const orderToUpdate = {
Id: this.headerId
, mDate__c: shippingDate // 出荷日
};
this.dispatchEvent(new FlowAttributeChangeEvent('xxxOut', orderToUpdate));
掲題のエラーを解消できる実装:
lwc.js
let shippingDate = this.shippingDate || null;
const orderToUpdate = {
Id: this.headerId
, mDate__c: shippingDate // 出荷日
};
this.dispatchEvent(new FlowAttributeChangeEvent('xxxOut', orderToUpdate));
エラー回避仕組み:
this.shippingDateが空白の場合は、nullをセット