Build delivery preview with custom variables

Avatar

Avatar

selvandhanm3541

Avatar

selvandhanm3541

selvandhanm3541

05-12-2017

Hello there,

I have scenario wherein I would like to get the (html) preview of a delivery template, find below the snippet I am using to build the preview:

But, the above code fails to generate the html as it was not able to resolve the variables in delivery template. Is there any way to pass the custom variables in the above code?

Have tried passing it through params (<params content="html" filter="@id=280519" myCustomVariable="myCustomValue" />), but it still doesn't resolves. Any help would be much appreciated.

Cheers,

Selva

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Vapsy

Employee

Avatar

Vapsy

Employee

Vapsy
Employee

14-12-2017

Hi Selva,

You cannot use such a seed address testing in a standalone delivery.

You will have to create a workflow which provides this targetData element to delivery. No need to run the workflow but the delivery activity needs this targetData element as part of incoming schema.

Then if you send the proof from delivery it will go out.

My seed address have to have additional data containing <targetData Survey_Unique_URL=”http://www.adobe.com” />

1373419_pastedImage_0.png

As stated earlier on this thread you will have to make the delivery believe that workflow is sending the same targetData to delivery.

As a result, I’ll just add a Query activity before it with a random selection query. Most important part if to provide targetData with alias name matching the field you need inside delivery.

1373471_pastedImage_1.png

1373472_pastedImage_2.png

Now the setup we have done, we don’t need to run the workflow. It was done to make delivery believe that targetData will coming in from outside if workflow is executed.

Now open the delivery and send a proof and it goes out successfully

Regards,

Vipul

Answers (9)

Answers (9)

Avatar

Avatar

selvandhanm3541

Avatar

selvandhanm3541

selvandhanm3541

14-12-2017

Hi Jean,

Thanks for the details. It doesn't works for me when I send it manually from the client console.

Here is the seed address target data:

<targetData>

  <localContent bodyText="Test Body Text"/>

</targetData>

So, when I execute the send proof with html containing <%= targetData.localContent.bodyText %> and with above seed address, I am getting the following error:

"JST-#ID# Error while compiling script 'content htmlContent' line 4: targetData is not defined. JavaScript: error while evaluating script 'content htmlContent'"

Also, had a look at the proof source and could see the FCPSeed element has got the targetData:

<FCPSeed _cs="Selvandhan Manivasagam" delivery-id="0" folder-id="1178" id="446355" internalName="ntSDM141" isModel="0" label="Selvandhan Manivasagam" proof-id="446354">

    <targetData>

        <localContent textBody="Test Body Text" />

    </targetData>

    <custom_nms_broadLog address="" format="0">

        <postalAddress>

            <address line1="" line2="" line3="" line4="" line5="" line6="" line7="" />

        </postalAddress>

    </custom_nms_broadLog>

    <custom_nms_recipient account="" agency="" birthDate="" blackList="0" company="" email="xxx@xx.xx" emailFormat="0" fax="" firstName="xxx" gender="0" language="" lastName="xxx" middleName="" mobilePhone="" origin="" phone="" salutation="Mr" status="0">

        <location address1="" address2="" address3="" address4="" city="" countryCode="" stateCode="" zipCode="" />

    </custom_nms_recipient>

    <proof _cs="[Proof 1] DELIVERY TEST (FCP_446354_ntDM352)" />

    <folder _cs="Seed addresses" />

</FCPSeed>

Please suggest. Thanks!

Avatar

Avatar

Jean-Serge_Biro

MVP

Avatar

Jean-Serge_Biro

MVP

Jean-Serge_Biro
MVP

08-12-2017

Hi Selva,

Please note the syntax to use within Javascript activity for acceding (getting/setting values) of variables defined in a delivery/delivery template in the Property/Variables of the delivery:

delivery.variables._var[0].stringValue = "XXX";

As I wrote in other ticket posts on same subject, please note that if you have already defined some variables in your delivery, the variables order is important, so adapt it accordingly in the Javascript code (_var[0] for 1st variable defined, _var[1] for the 2nd one, and so forth).

And take care: if you move variables in different order in the Property/variables form, the JS code must be adapted accordingly, because the index number won't change automatically

Regards
J-Serge

Avatar

Avatar

selvandhanm3541

Avatar

selvandhanm3541

selvandhanm3541

15-12-2017

Ah Ok, Thanks Vipul.

Avatar

Avatar

Jean-Serge_Biro

MVP

Avatar

Jean-Serge_Biro

MVP

Jean-Serge_Biro
MVP

14-12-2017

Hi Selva,

No I think I was wrong, very sorry.
targetData tab in Seed address is made for "replacing"/simulating the targetData coming from workflow.

So it should be possible to use it directly for your proof delivery.

The error "undefined" would be another reason, but I don't understand it by now.

Probably part of the SOAP code you use, though I am not sure.

Please may you confirm that when you send manually the Proof from the AC client, it works fine, and that it is only from SOAP call that there is an issue?


Regards
JS

Avatar

Avatar

selvandhanm3541

Avatar

selvandhanm3541

selvandhanm3541

14-12-2017

Thanks J-Serge.

Avatar

Avatar

Jean-Serge_Biro

MVP

Avatar

Jean-Serge_Biro

MVP

Jean-Serge_Biro
MVP

11-12-2017

Hi Selva,

Yes, it would be better to create a new ticket whenever another subject, and if the original subject is resolved, please put it as Resolved/correct response.

For your latter question, targetData XML elements are automatically added to the context by a workflow.
So if your SOAP code calls directly a delivery template to get the preview result, targetData won't be defined.
It is the same with the Additional Data section of Seed adresses;  to be valuable, the delivery must be called from a workflow, not directly.

Regards
J-Serge

Avatar

Avatar

selvandhanm3541

Avatar

selvandhanm3541

selvandhanm3541

11-12-2017

Thanks J-Serge. That was very useful.

I know this is a different topic, but your answer on this would be great. I have also targetData variables defined in my delivery like 'targetData.localContent.subject' and have defined this in my seed address targetData like the following:

<targetData>

<localContent subject="my email subject" />

</targetData>

But, when I execute the proof delivery using the seed address, I am getting targetData is undefined. Any suggestion? Thanks!

Cheers,

Selva

Avatar

Avatar

selvandhanm3541

Avatar

selvandhanm3541

selvandhanm3541

08-12-2017

Hi Florent,

Thanks for the response.

Actually, we are placing an campaign order from within another CMS (WebCenter Sites) [to manage content centrally] using Adobe Campaign OOTB SOAP endpoints which is working fine. But, we would need to display the preview of the email delivery from within the CMS before placing the order.

But, I am executing the above code snippet from within Adobe Campaign workflow using Javascript activity to test nms:delivery#BuildPreviewFromId.

Please let me know if you need more information, Thanks!

Cheers,

Selva

Avatar

Avatar

florentlb

Total Posts

1.1K

Likes

234

Correct Answer

239

Avatar

florentlb

Total Posts

1.1K

Likes

234

Correct Answer

239
florentlb

08-12-2017

Hi Selva,

I'm not sure I fully understand your scenario. You mention a delivery template but in your code I see delivery (and not delivery template). Where are you using this code?

Let us know,

Florent