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'})

this.fieldsActivity = this.milestoneFields;

// this.milestoneFields returns null
console.log('>>>>>> ' + this.fieldsActivity + this.milestoneFields);


Here is the code snippet in meta xml :

    <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"/>


Thanks in advance, Yagna


1 Answer 1


This started working when I deleted my lwc component in the Experience site -> published the changes. Added the lwc component again on the Exp site and published it. After re-adding the lwc component, the value in this.milestoneFields showed up correctly in console.log!!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .