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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

compute label name

vendimb15716755
Level 4
Level 4

HI

I am trying to generate a computed label on the delivery templates so that I can have generic name on the campaign deliveries( under Analysis tab) I have many deliveries so I dont want to have many campaign templates. for somehow when I enter a script i get an error when I include a conditional statement. Any Idea why is not working?

Welcome <% if (<%= recipient.productCode %>== "101") { %> camp1<% } %>

JST-310000 Error while compiling script 'delivery name' line 4: illegal XML character

delivery_label.png

1 Accepted Solution
Jean-Serge_Biro
Correct answer by
Community Advisor
Community Advisor

No, you can get values from your specific schema, but it should come from a 1-1 or N-1 relationship  (blue one) not from a 1-N relationship (yellow one) because otherwise how can you select the exact value between many records linked to your delivery ?
If you select a yellow relationship, AC takes randomly one record of the linked dimension.

1369058_pastedImage_0.png

View solution in original post

11 Replies
florentlb
Level 10
Level 10

Hi Vendim,

Can you share the whole script so we can take a look at it?

I'm not sure of what the best practices are in this case.

Florent

vendimb15716755
Level 4
Level 4

Hi Florent

thats the whole script. based on the value of that field I need to set the the delivery label name

I tried this both and it looks like doesnt recocnize the recipient at that level.( see below)

Welcome <% if (<%= recipient.productCode %>== "101") { %> camp1<% } %>

Welcome <%if(<%= recipient.firstName %> == "abc") { %> camp1<% }<% else { %>Test<% } %>

Jean-Serge_Biro
Community Advisor
Community Advisor

Hi Vendim,

It seems you put too much <% %>. Try this:

Welcome <% if (recipient.productCode == "101") { %> camp1<% } %>

and bad enclosing logic, try this:

Welcome <%if(recipient.firstName == "abc") { %> camp1<% } else { %>Test<% } %>

Regards
JS

vendimb15716755
Level 4
Level 4

HI JS

I have tried that It doesn't help. I get JST-310000 Error While compiling script 'delivery name' line 4: recipient is not defined

Welcome <%if(recipient.firstName == "abc") { %> camp1<% } else { %>Test<% } %>

Jean-Serge_Biro
Community Advisor
Community Advisor

yes of course, I forgot to mention it.

I guess you are misleading the label name of the delivery and the object of the mail, aren't you?

In the delivery properties tab,  you are at the delivery level. So it is common to all recipients targeted. It is the label name of the delivery, not the object of a specific message sent to a specific recipient...

So even if you want to put a valuable syntax such as:

<%= delivery.broadLogRcp.recipient.email %>

it would take one of the recipient of the 0,n relationship, by chance, which is not obviously what you meant to do.

Calculation delivery label name is for automating naming such as inserting month in the delivery label name from a model delivery.

Regards
JS

vendimb15716755
Level 4
Level 4

thanks JS for the Quick response

yes I am trying for the automation of the naming of deliveries

so since I have many deliveries that are common but I want to identify them on some characteristics that why I can trying to get that based on the product number( the recipient was to test if was able to get the name ) .

so you saying I cannot get a value from a specific schema there right? can I do with variables? Options?

Practially I was trying to give the workflow name based on their product that they belong too.

thanks

Jean-Serge_Biro
Correct answer by
Community Advisor
Community Advisor

No, you can get values from your specific schema, but it should come from a 1-1 or N-1 relationship  (blue one) not from a 1-N relationship (yellow one) because otherwise how can you select the exact value between many records linked to your delivery ?
If you select a yellow relationship, AC takes randomly one record of the linked dimension.

1369058_pastedImage_0.png

View solution in original post

vendimb15716755
Level 4
Level 4

This make much more sense. So at that level am I limited to only the objects( Schemas) that are listed there or I can build my custom schema ( N-1) or 1-1 and use that my look up for applying the logic on the statement?

Thanks again

vendimb15716755
Level 4
Level 4

Thanks JS

this was very helpful so solve my problem.

I will try with custom schema so we can Automate the naming of the deliveries based on some business rules ( instead of creating many templates)