Mass Updating Delivery Parameters | Community
Skip to main content
April 1, 2025
Solved

Mass Updating Delivery Parameters

  • April 1, 2025
  • 3 replies
  • 555 views

Hi Team,

I am writing a script to mass update parameters such as Sender Address and Reply Address from the Deliveries schema. Additionally, I need to update the Routing (External Account) of Delivery Templates, but I'm unable to do so as the value does not get updated when using the Routing Primary Key.

Moreover, I want to exclude OOTB Delivery Templates to ensure they are not modified or updated.

Below is the script I am using:

var delivery = NLWS.xtkQueryDef.create
(
{queryDef: {schema: vars.targetSchema , operation: 'select',
select:
{
node: [
{expr: '@id'},
{expr: '@from'},
{expr: '@reply'},
{expr: '@extAcct'},
]
}
}});
var results = delivery.ExecuteQuery();

for each (var res in results.getElements("query"))

{

delivery = NLWS.nmsDelivery.load(res.getAttribute('id'));
delivery.mailParameters.senderAddress= res.getAttribute('from');
delivery.mailParameters.replyAddress= res.getAttribute('reply');
delivery.deliveryProvider.id= res.getAttribute('extAcct');

 

delivery.save();

}

I need help with the following:

  1. Updating the Routing (External Account) in Delivery Templates – The value is not getting updated.

  2. Excluding OOTB Delivery Templates – How can I filter them out to avoid unintended modifications?

Any guidance on these points would be greatly appreciated.

Thanks,
Ankita Vishe



This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SushantTrimukheD

Hi @ankitavi1 ,

The issue you're encountering—where the deliveryProvider.id (Routing/External Account) isn’t updating—likely stems from how Adobe Campaign handles the deliveryProvider field. In the nms:delivery schema, deliveryProvider is a link to the xtk:provider schema (or nms:externalAccount in some contexts), and you need to set it using the correct foreign key reference. Simply assigning res.getAttribute('extAcct') to delivery.deliveryProvider.id may not work as expected because deliveryProvider is an object, not a direct field.

To update the Routing correctly:

  • Use the deliveryProvider link and set its id or load the external account explicitly.
  • Ensure extAcct in your query corresponds to a valid primary key from the nms:externalAccount schema.

Maybe you can try the below JS.

// Define the query to select delivery templates var deliveryQuery = NLWS.xtkQueryDef.create( { queryDef: { schema: "nms:delivery", operation: "select", select: { node: [ { expr: "@id" }, { expr: "@from" }, { expr: "@reply" }, { expr: "@extAcct" }, { expr: "@namespace" }, { expr: "@internalName" } ] }, where: { condition: [ { expr: "[@namespace] != 'nms'" }, // Exclude OOTB templates { expr: "[@isModel] = 1" } // Target templates only ] } } } ); // Execute the query var results = deliveryQuery.ExecuteQuery(); // Loop through results for each (var res in results) { var delivery = NLWS.nmsDelivery.load(res.@id.toString()); // Update sender and reply addresses delivery.mailParameters.senderAddress = res.@from.toString(); delivery.mailParameters.replyAddress = res.@reply.toString(); // Update Routing (External Account) if (res.@extAcct.toString() != "") { delivery.deliveryProvider = { id: res.@extAcct.toString() }; } // Save the delivery try { delivery.save(); logInfo("Updated delivery: " + res.@id.toString()); } catch (e) { logError("Failed to update delivery " + res.@id.toString() + ": " + e); } }


Thanks

Sushant Trimukhe

 

3 replies

SushantTrimukheD
SushantTrimukheDAccepted solution
Level 4
April 1, 2025

Hi @ankitavi1 ,

The issue you're encountering—where the deliveryProvider.id (Routing/External Account) isn’t updating—likely stems from how Adobe Campaign handles the deliveryProvider field. In the nms:delivery schema, deliveryProvider is a link to the xtk:provider schema (or nms:externalAccount in some contexts), and you need to set it using the correct foreign key reference. Simply assigning res.getAttribute('extAcct') to delivery.deliveryProvider.id may not work as expected because deliveryProvider is an object, not a direct field.

To update the Routing correctly:

  • Use the deliveryProvider link and set its id or load the external account explicitly.
  • Ensure extAcct in your query corresponds to a valid primary key from the nms:externalAccount schema.

Maybe you can try the below JS.

// Define the query to select delivery templates var deliveryQuery = NLWS.xtkQueryDef.create( { queryDef: { schema: "nms:delivery", operation: "select", select: { node: [ { expr: "@id" }, { expr: "@from" }, { expr: "@reply" }, { expr: "@extAcct" }, { expr: "@namespace" }, { expr: "@internalName" } ] }, where: { condition: [ { expr: "[@namespace] != 'nms'" }, // Exclude OOTB templates { expr: "[@isModel] = 1" } // Target templates only ] } } } ); // Execute the query var results = deliveryQuery.ExecuteQuery(); // Loop through results for each (var res in results) { var delivery = NLWS.nmsDelivery.load(res.@id.toString()); // Update sender and reply addresses delivery.mailParameters.senderAddress = res.@from.toString(); delivery.mailParameters.replyAddress = res.@reply.toString(); // Update Routing (External Account) if (res.@extAcct.toString() != "") { delivery.deliveryProvider = { id: res.@extAcct.toString() }; } // Save the delivery try { delivery.save(); logInfo("Updated delivery: " + res.@id.toString()); } catch (e) { logError("Failed to update delivery " + res.@id.toString() + ": " + e); } }


Thanks

Sushant Trimukhe

 

DavidKangni
Community Advisor
Community Advisor
April 1, 2025

@ankitavi1 

 

Use a query activity to get your deliveries which need to be updated and follow this 

 

Thanks,

David

 

David Kangni
Sukrity_Wadhwa
Community Manager
Community Manager
April 16, 2025

Hi @ankitavi1,

Were you able to resolve this query with the help of the provided solutions, or do you still need further assistance? Please let us know. If any of the answers were helpful in moving you closer to a resolution, even partially, we encourage you to mark the one that helped the most as the 'Correct Reply.'
Thank you!

Sukrity Wadhwa