Expand my Community achievements bar.

SOLVED

Typology rule to check the personalization block present in the email

Avatar

Level 4

Scenario: Create a typology rule which will check a personalization block is present in the email delivery and will stop the delivery if the personalization block is missing. 

 

All I could figure out as of now is : I have to create a control typology and in the html source need to check the personalization block- but the major issue is I do not have the syntax of fetching {nms:includeView} from delivery.content.html.source . 

 

1. Where to check the logInfo defined in a typology rule?

2. How to know the syntax if we have to create a new different typology in future? Any references?

3. Please let me know if there is any other way to achieve this.

 

Thank you so much in advance for any help and answer.

 

1 Accepted Solution

Avatar

Correct answer by
Level 10

Create a control typology rule and add it to your desired typology and assign that to your template, use the code below to check for the personalization internalname

David__Garcia_2-1636598579256.png

 

 

var x = "dummy_personalization"; //internalname of personalization block
var y = delivery.content.html.source;
var z = y.search(x);

if (z !== -1) { //if not found it returns -1
    logInfo("Found personalization block: " + x);
    return true
} else {
    logWarning("Missing personalization block: " + x);
    return false
}

David__Garcia_1-1636598357603.png

 

 

 

View solution in original post

3 Replies

Avatar

Level 9

Hi @Poonam_Dogra ,

 

We always use one of the personalisation block in our delivery, i.e Mirror Page.

And there is a typology rule which looks whether Mirror Page is included in Delivery or not. You can use this typology rule in your typology and validate whether it has a Personalisation Block included or not.

 

Typology Rule: Social network sharing link validation(viral)

 

Thanks,

Jyoti

Avatar

Correct answer by
Level 10

Create a control typology rule and add it to your desired typology and assign that to your template, use the code below to check for the personalization internalname

David__Garcia_2-1636598579256.png

 

 

var x = "dummy_personalization"; //internalname of personalization block
var y = delivery.content.html.source;
var z = y.search(x);

if (z !== -1) { //if not found it returns -1
    logInfo("Found personalization block: " + x);
    return true
} else {
    logWarning("Missing personalization block: " + x);
    return false
}

David__Garcia_1-1636598357603.png

 

 

 

Avatar

Level 4

Thank you so much @david--garcia for sharing the demo, it worked perfectly fine....

Regards,

Poonam