Expand my Community achievements bar.

SOLVED

Capabilities of content blocks in Adobe Campaign Standard

Avatar

Level 3

Hi,

Is it possible to query the database in a content block's code in Adobe Campaign Standard?

It would be very useful if we could write a content block that can execute a query on the database and extract some information to be included in the email.

However I didn't find JS API documentation for content blocks and I don't know if this is possible or not.

Thanks,

Kornél

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi Florent,

Currently I'm exploring the content blocks' capabilities for displaying dynamic content in transactional emails.

So far I managed to be able to develop JS for:

- Conditional displaying of event attributes (context.rtEvent.ctx...) and html when the event attribute is not blank.

- For loops to display contents of collections in the real-time event.

This is what I referred to as "Use case 1" above.

"Use case 2" looks a bit more complex to realize, probably this is beyond the intended use of content blocks. However this is not a blocker, but could simplify some of our solutions if that is doable.

Thanks,

Kornél

View solution in original post

8 Replies

Avatar

Level 10

Hi Kornél,

You cannot write JS code in a content block in ACS, hence I assume that was you want to achieve is not possible this way.

What kind of information would you like to get and add to your email? Depending on what you need, there may be other possibilities.

Let me know,

Florent

Avatar

Level 3

Hi Florent,

We have several requirements that would be realized using JS inside content blocks. It seems to work, see case 1 below. However I don't find a solution for case 2.

Use case 1:

Display attributes (from real time event) conditionally, or iterate through elements of collections and render a table.

This is doable, e.g. see the OOB content block: Greetings.

Use case 2:

Based on constant value or variables we would like to query a specific resource and implement content logic based on it. E.g. look up something in a custom resource (dictionary, etc.).

I don't see a solution for this based on OOB content block examples.

I understand that the way to realize use case 2 would be to do enrichment or reconciliation (link resources), but I wanted to find out if I can access resources from a content block programmatically, too.

Thanks,

Kornél

Avatar

Level 10

Hi Kornel,

I know that some of the OOB blocks have some JS inside but I'm not sure it is allowed to write JS in custom blocks. I'll check what is do-able from your use cases.

Let us know if you manage to write something that works for you,

Florent

Avatar

Correct answer by
Level 3

Hi Florent,

Currently I'm exploring the content blocks' capabilities for displaying dynamic content in transactional emails.

So far I managed to be able to develop JS for:

- Conditional displaying of event attributes (context.rtEvent.ctx...) and html when the event attribute is not blank.

- For loops to display contents of collections in the real-time event.

This is what I referred to as "Use case 1" above.

"Use case 2" looks a bit more complex to realize, probably this is beyond the intended use of content blocks. However this is not a blocker, but could simplify some of our solutions if that is doable.

Thanks,

Kornél

Avatar

Level 10

Thanks for the update Kornel,

I'll try to see what's possible in the context of transactional messages.

Florent

Avatar

Level 2

Hi Florent

Did you find any further information regarding js in content blocks?

Jesper

Avatar

Level 10

Hi,

As Kornel mentioned, this looks do-able.

Though, I'm still not sure that this is the intended use for this so I cannot really give some guidance here.

Perhaps Kornel will be willing to share some of his findings.

Thanks,

Florent

Avatar

Level 2

Hey Florent,

Is it possible for us to feature the logic in the block directly (so that we don’t have to feature the dynamic content rule in the content editor of the delivery?

Is there a possible way to use <% if / else %>..

Thanks,

Sangram