Avatar

Level 4

Hi @MarceL,

 

I tried to send out the delivery through API method like below. I am pulling the emails from query activity and looping through the API like below: 

 

This is my workflow : 

 

Ramaswami_0-1605467226261.png

 

inside the javascript: 

 

logInfo("Table name:"+vars.tableName);


var cnx = application.getConnection();

var details = cnx.query("select semail from "+vars.tableName);

for each(var row in details)
{
logInfo("row[1]:"+row[0]);

var emailCondition = "@email = '"+row[0]+"'";
var deliveryname = "prdDM30934274";
logInfo("before delivery");
var deliveryId = nms.delivery.SubmitNotification (deliveryname,
<delivery>
<targets >
<deliveryTarget >
<targetPart type='query' exclusion='false' ignoreDeleteStatus='false'>
<where>
<condition expr={emailCondition} />
</where>
</targetPart>
</deliveryTarget>
</targets>
</delivery>);

logInfo("deliveryid : "+deliveryId)

}

 

Concerns with the above code : the delivery template is having some variable pipe-in like <%=recipient.firstname%> but when I loop through the emails which got from query activity i am only passing the email address. 

 

if for above example : i am query respondent id = 1303 whose first name = Suri and email = suri@gmail.com, we also have a respondent whose respondent id = 444 whose first name = venkatsuri and email = suri@gmail.com( which is the same as 1303) 

 

now the problem here is the javascript API method when i query for 1303 it's piping the values of 444 respondent. Can we pass the variables like firstname, etc., through this API ? is there a way?