Use current campaign name in typology rule

Avatar

Avatar
Validate 1
Level 2
AC_Bella
Level 2

Likes

6 likes

Total Posts

14 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
AC_Bella
Level 2

Likes

6 likes

Total Posts

14 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
AC_Bella
Level 2

25-11-2019

Hello everyone,

currently I am trying to create a typology rule which makes sure that a recipient does not get the same Email-campaign twice.

It seems that I have to use JavaScript to retrieve the campaign name from where the delivery is startet.

I thought maybe something like this could work:

// Define campaign name of current workflow where delivery is located.

function currentCampaignName(){

// Get primary key from workflow.

  var workflowID = instance.id;

  var tmpCon = application.getConnection();

  var internalName = tmpCon.query("SELECT O1.sInternalName FROM XtkWorkflow W0 JOIN NmsOperation O1 ON (O1.iOperationId = W0.iOperationId) WHERE W0.iWorkflowId = $(l)",workflowID);

  for each(var row in internalName)

    var campaignName = row[0];

  return campaignName;

}

// Exclude recipients which got the defined campaign within last 60 days.

function excludeRecipients (){

  var tmpCon = application.getConnection();

  var campaignName_compare = currentCampaignName();

  // Select all delivery logs of recipient from current campaign.

  var broadLog_array = tmpCon.query("SELECT COUNT(B0.iBroadLogId) FROM NmsBroadLogRcp B0 JOIN NmsDelivery D1 ON (D1.iDeliveryId = B0.iDeliveryId) JOIN NmsOperation O2 ON (O2.iOperationId = D1.iOperationId) WHERE O2.sInternalName = $(sz)", campaignName_compare);

for each(var row in broadLog_array)

     var countBroadLog = row[0];

     if(countBroadLog > 0) {

       return false;

     } else {

       return true;

     }

}

return excludeRecipients();






It works if I put it within a JavaScript component of a workflow but within a typologie rule I get the following error:

1857911_pastedImage_5.png

Since "instance" is apparently not available within a delivery what should I use instead to get the campaign name?

Or do you have a better solution at hand?

Best,

Bella

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
MVP
Jyoti_Y
MVP

Likes

88 likes

Total Posts

123 posts

Correct reply

55 solutions
Top badges earned
Boost 50
Shape 1
Boost 5
Give Back 5
Give Back 3
View profile

Avatar
Boost 50
MVP
Jyoti_Y
MVP

Likes

88 likes

Total Posts

123 posts

Correct reply

55 solutions
Top badges earned
Boost 50
Shape 1
Boost 5
Give Back 5
Give Back 3
View profile
Jyoti_Y
MVP

26-11-2019

Hi,

You can write query condition in typology rule to get campaign name:

var query= xtk.queryDef.create(

                 <queryDef schema="nms:delivery" operation="get">

                   <select >

                  <node expr="[operation/@internalName]" alias="@campaignName" />

                  </select>

                 <where>

                  <condition expr={"@id=" + delivery.id}/>

                 </where>

                 </queryDef> )

var campaignName= query.ExecuteQuery().@campaignName.toString();

Thanks.

Answers (3)

Answers (3)

Avatar

Avatar
Affirm 100
MVP
_Manoj_Kumar
MVP

Likes

115 likes

Total Posts

328 posts

Correct reply

101 solutions
Top badges earned
Affirm 100
Validate 1
Contributor
Ignite 1
Shape 1
View profile

Avatar
Affirm 100
MVP
_Manoj_Kumar
MVP

Likes

115 likes

Total Posts

328 posts

Correct reply

101 solutions
Top badges earned
Affirm 100
Validate 1
Contributor
Ignite 1
Shape 1
View profile
_Manoj_Kumar
MVP

26-11-2019

You can just add a split activity that will look at delivery logs for the specific delivery code. if the delivery code exists then exclude the audience else you can send them the communication.

Thanks,

Manoj

Avatar

Avatar
Validate 1
Level 2
kaushal13
Level 2

Likes

2 likes

Total Posts

10 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Ignite 1
Boost 1
View profile

Avatar
Validate 1
Level 2
kaushal13
Level 2

Likes

2 likes

Total Posts

10 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Ignite 1
Boost 1
View profile
kaushal13
Level 2

27-04-2021

Hi ,

Looking for similar solution where one delivery is used a campaign should be excluded for rest of day. 

Any help appreciated as able example looks similar is tried in typology rule . Did you got how to call the js in typology and which type ex - filter or control method is used. 

 

thanks,

Kaushal

Avatar

Avatar
Validate 1
Level 2
AC_Bella
Level 2

Likes

6 likes

Total Posts

14 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
AC_Bella
Level 2

Likes

6 likes

Total Posts

14 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
AC_Bella
Level 2

04-12-2019

Hi Manoj,

I would definitely use that if it would be only me but I need something simple for our campaign managers - something which happens in the background and they don't have to think about.

I'll try the JavaScript code next.

Thanks for your help!