Expand my Community achievements bar.

SOLVED

Update Delivery template Properties

Avatar

Level 3

Hi All,

 

I need some help, if someone has done it please share thoughts or send me in right direction.

 

I have more than 100 Email Delivery templates for different brands and I have to make couple of change in the properties of these templates. Changes includes updating 'Execution Folder', 'Routing', 'Web Analytics Account' and 'Typology'. These properties already have value but I need them to update with new ones.

 

I have highlighted the updates I need to made in below example image:

parmeshwarr3905_0-1658851889486.png

 

parmeshwarr3905_2-1658852140010.png

 

 

parmeshwarr3905_1-1658851940922.png

 

 

can we achieve this through workflow or any other way?

Appreciate your help, Thanks!!

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

The javascript option @_Manoj_Kumar_ will work.

If you wanted a non scripting way to do you can navigate to your templates folder then filter for all the correct templates. Once you have the correct templates select them all.

Then right click -> Actions -> Mass Update of Selected Lines 

then the dialogue will allow you to enter what field and values should be populated.

 

This will update all the templates you've selected with the fields and values you specified.

dloyd_0-1658923060072.png

 

View solution in original post

5 Replies

Avatar

Community Advisor

Hello @parmeshwarr3905 

 

You will have to write a javascript code to pull the deliveries and then update the ids. First get the primary keys of your routing, web analytics account, and execution folder and use this script to modify your details and use case.

var q = xtk.queryDef.create(
  <queryDef schema="nms:delivery" operation="select" >
    <select>
      <node expr="@id" alias="@id"/>         
    </select>      
   </queryDef>
);
var deliveries = q.ExecuteQuery();

for each(var d in deliveries){
   var delivery=nms.delivery.load(d.@id);
	delivery.deliveryProvider-id=123; // Routing primary key
	delivery.typology-id=123; // Typolofy primary key
	delivery.folderProcess-id=222; // execution primary key
	delivery.webAnalyticsAccount-id=123; //web analytics account primary key
	delivery.save();
}

Note: This script is an example only. You will have to change a few things according to your requirement.

 


     Manoj
     Find me on LinkedIn

Avatar

Level 3

@_Manoj_Kumar_ 

 

I have modified query by adding where condition to test it but it's throwing an error. Please let me know how can I update the script to resolve this 

 

parmeshwarr3905_0-1658923099143.png

 

Avatar

Employee Advisor

try taking the comments completely out

remove these

 // Routing primary key

 

Avatar

Level 3

@David_Loyd Yes I tried that. But no luck. I though it needed '==' to assign new id in that case it says 'id' not defined.

Avatar

Correct answer by
Employee Advisor

The javascript option @_Manoj_Kumar_ will work.

If you wanted a non scripting way to do you can navigate to your templates folder then filter for all the correct templates. Once you have the correct templates select them all.

Then right click -> Actions -> Mass Update of Selected Lines 

then the dialogue will allow you to enter what field and values should be populated.

 

This will update all the templates you've selected with the fields and values you specified.

dloyd_0-1658923060072.png