I am trying to set a @track variable in my LWC JS using default value in target config property defined in -meta.xml. When I console.log on the target config value in JS, it returns null.
Here is my JS code snippet:
import { LightningElement, track, wire, api } from 'lwc';
import getStrategyToActivity from '@salesforce/apex/GetDelieverableWorkPlanDetail.getStrategyToActivity';
export default class Deliverable_workplandetailview_lwc extends LightningElement {
@track fieldsActivity;
@api milestoneFields;
@api recordId;
@wire(getStrategyToActivity, {
delId : '$recordId'})
wiredgetStrategyToActivity({error,data}){
if(data)
{
console.log('----',JSON.stringify(data));
this.fieldsActivity = this.milestoneFields;
// this.milestoneFields returns null
console.log('>>>>>> ' + this.fieldsActivity + this.milestoneFields);
}
}
Here is the code snippet in meta xml :
<targets>
<target>lightningCommunity__Page</target>
<target>lightningCommunity__Default</target>
<target>lightning__RecordPage</target>
</targets>
<targetConfigs>
<targetConfig targets="lightningCommunity__Default">
<property name="recordId" type="String" label="recordId" default=""/>
<property name="milestoneFields" type="String" label="milestoneFields" default="Milestone__c,Person_Responsible__c"/>
</targetConfig>
Thanks in advance, Yagna