Skip to main content
Sep 14, 2021 2:51 AM UTC
Solved

Fetching the internal name of the recurring delivery dynamically

Hello All,

 

I have been trying to fetch the internal name for the recurring delivery configured in the campaign workflow dynamically in the initialization script, but unable to do so successfully.

Already tried with delivery.internalName and activity.delivery.internalName, but none of them worked.

 

I am not looking for the internal name of the delivery generated, but the one that exists in the workflow.

 

Looking for some help here.


Thanks!
Dheeraj

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Manoj_Kumar
Manoj_KumarAccepted solution
Community Advisor
Sep 15, 2021 4:08 PM UTC

@dheerajgarg  In that case you can change the operation to select and loop the result to get the delivery names.

 

The Code would look something like this.

 

var q = xtk.queryDef.create(
  <queryDef schema="nms:delivery" operation="select">
    <select>
      <node expr="@internalName"/>    
    </select>
    <where>     
        <condition expr={"[@workflow-id] ="+instance.id}  /> 
    </where>
      
  </queryDef>
);
var deliveries= q.ExecuteQuery();
for each(var delivery in deliveries.delivery){
  logInfo(delivery.@internalName)
}
Manoj  | https://themartech.pro

10 replies

Jyoti_Yadav
Level 8
Sep 14, 2021 5:48 AM UTC

Hi @dheerajgarg ,

 

You can see your recurring Delivery internal name at:

[target/recurringDelivery/@internalName]

 

Thanks,

Jyoti

Translate
Sep 14, 2021 6:11 AM UTC

Hi @jyoti_yadav 

 

Thanks for looking into it.

 

The target dimension option is not available in the Advanced script tab. If we mean to check within activity, then I already tried with activity.delivery.internalName, which unfortunately doesn't work and result in an empty value


Snapshots below for your reference

 

 

 

What we are trying to get is the following internal name of the delivery configured dynamically:


The test workflow we have created is a simple one, with a query on nms:recipient and recurring delivery.

 


Best
Dheeraj

Translate
Jyoti_Yadav
Level 8
Sep 14, 2021 6:18 AM UTC

Hi @dheerajgarg ,

What do you want to achieve by finding delivery internal name? You can write query and then find out the delivery internal name.

Thanks,

Jyoti

Translate
Manoj_Kumar
Community Advisor
Community Advisor
Sep 14, 2021 8:17 PM UTC

Hello @dheerajgarg 

 

Try using this code:

 

 var q = xtk.queryDef.create(
  <queryDef schema="nms:delivery" operation="get">
    <select>
      <node expr="@internalName"/>    
    </select>
    <where>     
        <condition expr={"[@workflow-id] ="+instance.id}  /> 
    </where>
      
  </queryDef>
);
var delivery= q.ExecuteQuery();
logInfo("Name:"+delivery.@internalName);
Translate
Manoj  | https://themartech.pro
Sep 15, 2021 4:05 PM UTC

Hello @_manoj_kumar_ -

Thanks for looking into it. This logic can work if there is one delivery in the workflow, but what if we have more than one deliveries configured in the same workflow?

Translate
Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
Sep 15, 2021 4:08 PM UTC

@dheerajgarg  In that case you can change the operation to select and loop the result to get the delivery names.

 

The Code would look something like this.

 

var q = xtk.queryDef.create(
  <queryDef schema="nms:delivery" operation="select">
    <select>
      <node expr="@internalName"/>    
    </select>
    <where>     
        <condition expr={"[@workflow-id] ="+instance.id}  /> 
    </where>
      
  </queryDef>
);
var deliveries= q.ExecuteQuery();
for each(var delivery in deliveries.delivery){
  logInfo(delivery.@internalName)
}
Translate
Manoj  | https://themartech.pro