Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

Fetching the internal name of the recurring delivery dynamically

Avatar

Level 1

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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
     Find me on LinkedIn

View solution in original post

10 Replies

Avatar

Community Advisor

Hi @DheerajGarg ,

 

You can see your recurring Delivery internal name at:

[target/recurringDelivery/@internalName]

 

Thanks,

Jyoti

Avatar

Level 1

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

 

DheerajGarg_0-1631599322994.png

 

DheerajGarg_0-1631599665535.png

 

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

DheerajGarg_1-1631599754667.png


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

 

DheerajGarg_2-1631599803191.png


Best
Dheeraj

Avatar

Community Advisor

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

Avatar

Level 1

@Jyoti_Yadav - The purpose to find the delivery name is to use it as a where clause for the query to find that delivery.
Hope that makes sense

Avatar

Community Advisor

Hi @DheerajGarg ,

You are not getting name while executing delivery is because "Advanced Tab runs before delivery is executed". This is the reason no value is populated.

If you need the 'deliveryName' for query, then use query activity after delivery. In the Advanced tab of Query activity write

logInfo("delId: "+ vars.deliveryId);

Save this in an instance variable and use the same variable in your Query activity.

Jyoti_Y_0-1631602590476.pngJyoti_Y_1-1631602607471.png

PFB Workflow design for your reference:

Jyoti_Y_2-1631602638682.png

Thanks,

Jyoti

 

Avatar

Level 1

Hi @Jyoti_Yadav - The way you suggested is for finding the name of the delivery object created. However, that is not our requirement as of now.

The internal name which we are trying to find is stored somewhere, so couldn't there be a way to retrieve it?

 

Thanks
Dheeraj

Avatar

Community Advisor

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);

     Manoj
     Find me on LinkedIn

Avatar

Level 1

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?

Avatar

Correct answer by
Community Advisor

@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
     Find me on LinkedIn