Delivery personalization - N table

jose_miguelm677

11-07-2019

Hi All,

I need to personalize an email with the information of an N table linked to recipient. This must be done without a workflow.

I am able to extract the information using the "Extra script objects" in the personalization tab of the delivery:

1788840_pastedImage_0.png

But i need this query to be dynamic and filtered for the specific recipient. Currently I am able to get information but i must hardcode the recipient ID or email, is there a way to make this dynamic?

FYI, this would be sent using the method SubmitNotification that passes the target's ID.

Appreciate any help.

Kind Regards,

Jose

Answers (4)

Answers (4)

jose_miguelm677

11-07-2019

Hi,

So based on the thread that you provided i was able to make it work

The example that i am using right now is:

var deliveryId = nms.delivery.SubmitDelivery(templateId,

            <delivery>

                <targets>

                    <deliveryTarget nonEmpty="true">

                        <targetPart exclusion='false' ignoreDeleteStatus='false'>

                            <where>

                                <condition expr={"@id='" + recipientId + "'"} />

                            </where>

                        </targetPart>

                    </deliveryTarget>

                </targets>

                <content addExtraObject="true">

                  <html>

                    <source>{abc}</source>

                  </html>

                  <extraObject array="true" jsName="testing" schema="cus:schema" startPath="/">

                    <custom>

                      <select>

                         <node analyze="false" expr="@field" label="" />

                      </select>

                   </custom>

                   <where displayFilter="primary key of recipient" filteringSchema="cus:schema">

                      <condition expr={"[Recipient/@id] ="+recipientId}/>

                   </where>

                 </extraObject>

                </content>

            </delivery>

        );

So, i had to change the method to Submit Delivery and add the "extra Object" to the XML.

Thank you for your help!

jose_miguelm677

11-07-2019

Hi,

Thank you for your input.

I see in that thread that you are able to set the target (which i am already doing) and also change the content. I'll try to configure the extra object filter this way to see if i can do it dynamically.

jose_miguelm677

11-07-2019

Hi,

So in my delivery i want to add transactions of the recipient. This is a link of Recipient 1 - N Transactions, and as such, i don't have easy access to this information with simple personalization.

Investigating, i found that i can use the "extra script objects" to do this query and get the information which i would then process and put in the email (The information would be available via JS).

The problem is that i need to get the transactions of the recipient and i'm not sure how to filter this query accordingly when creating the extra script object:

1788861_pastedImage_0.png

I can very well hardcode a recipient ID but i need it to be filled in dynamically for each recipient.

Things to take into account is that this delivery would be sent via JS, not a workflow, so I don't have access to Advanced Scripts of delivery activities.

I hope this is clearer.

Kind Regards,

Jose