Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

send customizable email using nms.delivery.SubmitDelivery SOAP API

Avatar

Level 2

I have created a Delivery Template with variables and used those variables in the Delivery Template email. How to pass values to those variables using nms.delivery.SubmitDelivery SOAP API Call...

 

var emailCondition = "@email = 'xyz@abc.com'";


var deliveryId = nms.delivery.SubmitDelivery("gEmail",
<delivery>
<targets >
<deliveryTarget >
<targetPart exclusion='false' ignoreDeleteStatus='false'>
<where>
<condition expr={emailCondition} />
</where>
</targetPart>
</deliveryTarget>
</targets>
</delivery>);

16 Replies

Avatar

Community Advisor

Hi,

 

Are you trying to call nms:delivery#SubmitDelivery via SOAP, or the code pasted below?

Is the code in a workflow?

 

Thanks,

-Jon

Avatar

Community Advisor

Call the workflow with xtk:workflow#PostEvent, setting <variables emailCondition="@email = 'xyz@abc.com'"/>. The js should prob be tightened up to <condition expr={"@email = '" + sanitize(vars.emailCondition) + "'"} />, but will work as-is.

Avatar

Level 2
The above nms.delivery.SubmitDelivery code is working fine for me. But I would like to know how to pass the variables to {variables._var[0], variables._var[1]} delivery template while calling though js

Avatar

Community Advisor
You don't need to do that, just use your og code. You have to reference emailCondition under the vars object, so change to vars.emailCondition.

Avatar

Level 4

hi @kgiribabu,

 

I have encountered with same situation. i need to pass the variables which are calculated in query activity like targetData.currentDate which are piped in the email template. Any ideas here?

 

@Manoj_Kumar_ : the example you have given is not working for me passing the variables through API. Do you have any other solution for this.?

 

@Jonathon_wodnicki any suggestions here?

Avatar

Community Advisor

Hello @kgiribabu 

 

You can try this.

var emailCondition = "@email = 'xyz@abc.com'";


var deliveryId = nms.delivery.SubmitDelivery("gEmail",
<delivery>
<targets >
<deliveryTarget >
<targetPart exclusion='false' ignoreDeleteStatus='false'>
<where>
<condition expr={emailCondition} />
</where>
</targetPart>
</deliveryTarget>
</targets>
<variables>
<var><stringValue>VALUE_1_HERE</stringValue></var>
<var><stringValue>VALUE_2_HERE</stringValue></var>
</variables>
</delivery>);

Avatar

Level 2

js2 Element 'stringValue' is unknown (see definition of element '/variables/var' in schema 'Deliveries (nms:delivery)').

Avatar

Level 2
@Manoj_Kumar_ I don't know how to access 'definition of element '/variables/var' in schema 'Deliveries (nms:delivery)''

Avatar

Level 2

@Manoj_Kumar_, @Jonathon_wodnicki I tried below combination and all of them giving similar error : 'see definition of element '/variables/var' in schema 'Deliveries (nms:delivery)'.. How to access this schema definition ?

 

<variables>
<var><value>ASDF</value></var>
</variables>

 

<variables>
<var><stringValue>ASDF</stringValue></var>
</variables>

 

<variables>
<var stringValue='ASDF'/>
</variables>

 

<variables>
<var value='ASDF'/>
</variables>

Avatar

Level 2
I tried all the combination listed below post and none of them worked,.