Email Loop in ACS | Community
Skip to main content
New Participant
April 3, 2024
Solved

Email Loop in ACS

  • April 3, 2024
  • 2 replies
  • 2064 views

I have a query resulting in multiple lines that I need to display in an email to then send it to the rcpManager which is the profile I need to send the email to.

 

facilityIdNameAddr1Addr2EmailPhonemanagerCodercpManager
123Joe's GarageLoremDolorjoe@garage.com123455manager@adobe.com
456Car ExpressIpsumSit Ametcar@express.com67785manager@adobe.com

 

Now, I need to display these in an email using a loop, but it doesnt seem to work for me?

 

 

 

 

 

<% for (var i =0;i<=context.targetData.length;i++) { %> <!---somehtml tables and columns here---> <%= context.targetData[i].facilityId%> </span> <%= context.targetData[i].name%> </span> <%= context.targetData[i].Addr1%> </span> <%}%>

 

 

 

If I try to get the length of targetData it comes back as undefined

`<%= context.targetData.length %>` --> undefined

 

If I get the length of facilityId its fine.so how do I iterate through all the rows?

 

`<%= context.targetData.facilityId.length %>` --> 8

 

 

What would be the correct way?

@satheeskannak 

 

 
 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SatheeskannaK

@o_x, You will not be able to get the length of the link rather it will work on the additional data field. You can correlate this with the visibility condition, If you look at the visibility condition to display the structure component it will work on the field level.

2 replies

o_XAuthor
New Participant
April 11, 2024

Anyone? this should be a basic thing to do, I doubt im the only one facing this issue?

SatheeskannaK
SatheeskannaKAccepted solution
New Participant
April 12, 2024

@o_x, You will not be able to get the length of the link rather it will work on the additional data field. You can correlate this with the visibility condition, If you look at the visibility condition to display the structure component it will work on the field level.

Thanks, Sathees
_Manoj_Kumar_
New Participant
April 3, 2024

Hello @o_x 

 

What do you get when you print this?

<%= context.targetData.facility.length %>

     Manoj     Find me on LinkedIn
o_XAuthor
New Participant
April 3, 2024

I get the length of the facilityid value in integer, the template seems to only just fetch a random record out of the two that I want to iterate.

 

8

_Manoj_Kumar_
New Participant
April 4, 2024

What is the schema structure? It is possible to share the screenshot of targeting dimension and targetData?

     Manoj     Find me on LinkedIn