//Info: CDUS-2127
We met a requirement where we needed to update the content in an email body which was generated through certain criteria.
The email content will be changed based on the location selected in the Sales Order and this should be reflected in the associated Html file.
Solution:
We already predefined the content in the HTML file and the tag
<!--replaceAddress#-->
were added in the position where the value needs to be updated.
On the criteria checked MapReduce script,
we have added the script to change the value based on the location selected.
var currentAddress = "CorpDesign, Avenue Miami"
if (emailSendDetailsArray[i].soBodyLocation == 1) {
subject += " (Miami)";
latestContent = updatedContent.replace("<!--replaceAddress#-->", currentAddress)
}
Note:
Here, updatedContent is the existing table with data and we can update the address with multiple locations.