Expand my Community achievements bar.

SOLVED

Using custom API calls in Delivery

Avatar

Level 2

Hello,

We have a need to use a variable inside of a delivery which is being generated by using the .js API to query a data table containing advisors and their assigned wholesalers, then create an array of the advisors and include that in a delivery to each wholesaler. How can we include this array inside the delivery? Since it is dynamic & a different array of advisors for each wholesaler (the delivery recipients),  I don't believe the built-in delivery variables can accommodate. We attempted to use Personalization Blocks but it appears those aren't capable running queries & returning the results as variables. Working JS snippet attached... now we are just trying to figure out how to carry the advisorArray into the delivery. Any suggestions are appreciated.

 

Bowenaus_0-1604346676585.png

 

Thank you,

Austin

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi Austin - it sounds from what you are trying to do you just need format the output of the array (Advisors) into the content of the Email? If that is the case then I would just enrich a text field onto the schema and add some HTML text into it based on the array content for each target. So basically the variable on the schema contains your output HTML block.

You can do this in your query by getting the temporary schema and writing back to it with the contents of the text/memo field with your HTML (as text). Check out this post on how to do this: https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-classic-questions/advanced-workflow-...

Cheers

Darren

 

View solution in original post

5 Replies

Avatar

Correct answer by
Level 9

Hi Austin - it sounds from what you are trying to do you just need format the output of the array (Advisors) into the content of the Email? If that is the case then I would just enrich a text field onto the schema and add some HTML text into it based on the array content for each target. So basically the variable on the schema contains your output HTML block.

You can do this in your query by getting the temporary schema and writing back to it with the contents of the text/memo field with your HTML (as text). Check out this post on how to do this: https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-classic-questions/advanced-workflow-...

Cheers

Darren

 

Avatar

Level 2
Thanks Darren. That's a great suggestion. I will give this a shot today & see if I can get those arrays added to the temp schema in the form of text fields.

Avatar

Level 2
Were you able to find a solution for displaying the contents of the memo/text field in the email? I can see the values in the schema but in the delivery <%= targetData.advisors %> is just rendering blank.

Avatar

Level 9
What type of field did you use to store the advisors HTML? I had major issues trying to use an actual memo/html field so just used a normal string field to store the HTML I wanted to insert. Also be aware that you probabaly need to HTMLencode the data you put into the temporary variable

Avatar

Level 2
I ended up doing the same. Tried using the memo field, but later found out since that is an XML type & not a SQL field it can't be used in deliveries. So, I ended up using a string with length="1000" to allow the advisor HTML data to fit. Seems to be working now, thanks again!