jb

<pre> const replacePlaceholders = (obj: any, parent: any = null, keyInParent: any = null, actionData: any = null) =&gt; { for (const key in obj) { if (obj.hasOwnProperty(key)) { const value = obj[key]; if (key === &#39;fillMethod&#39; || key === &#39;multiIntentData&#39;) continue; if (key === &#39;items&#39;) { for(let i=0; i&lt;value.length;i++) { //Extract intent from placeholder and get actionDataArray const intent = extractIntent(value[i]); const actionDataArray = getActionData(intent, intentName); // Check the fillMethod of the parent object const fillMethod = obj.fillMethod || &#39;latest&#39;; if (fillMethod === &#39;all&#39;) { parent[keyInParent] = actionDataArray.map((actionData) =&gt; { let newItem = JSON.parse(JSON.stringify(value[i])); replacePlaceholders(newItem, null, null, actionData); return newItem; }); } else { const latestActionData = getLatestActionData(intent, intentName); const newItem = JSON.parse(JSON.stringify(value[i])); replacePlaceholders(newItem, null, null, latestActionData); parent[keyInParent] = [newItem]; } } continue; } if (typeof value === &#39;string&#39; &amp;&amp; value.startsWith(&#39;$&#39;)) { const [intent, field] = value.substr(1).split(&#39;.&#39;); if(actionData &amp;&amp; actionData[&#39;IntentName&#39;] === intent) { const fieldValue = actionData[field]; obj[key] = (fieldValue!== undefined &amp;&amp; fieldValue!==null) ? fieldValue : null; } else { const latestActionData = getLatestActionData(intent, intentName); const fieldValue = latestActionData[field]; obj[key] = (fieldValue!== undefined &amp;&amp; fieldValue!==null) ? fieldValue : null; } } else if (Array.isArray(value) || typeof value === &#39;object&#39;) { replacePlaceholders(value, obj, key, actionData); } if(obj.enableStartEndDate === &#39;true&#39;){ Object.assign(obj.data,this.getStartEndDate(intentConfig.numberOfDays)) delete obj.enableStartEndDate; } } } };</pre>