Expand my Community achievements bar.

SOLVED

compute label name

Avatar

Level 5

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

Avatar

Correct answer by
Level 10

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

Avatar

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

Avatar

Level 5

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<% } %>

Avatar

Level 10

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

Avatar

Level 5

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<% } %>

Avatar

Level 10

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

Avatar

Level 5

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

Avatar

Correct answer by
Level 10

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

Avatar

Level 5

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

Avatar

Level 5

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)