Expand my Community achievements bar.

SOLVED

Update sender address

Avatar

Level 2

Hi!

I want mass update sender and reply address for delivery templates. 

But this information is only in XML memo.

So how I can do it? Via JavaScript or something else?

MariaKonstantinova1995_0-1666797087586.png

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @MariaKonstantinova1995 ,

if you want to programatically change sender information you need to create workflow where

  • query all delivery templates
  • in JS activity query the results from temp:query
  • loop over all templates
  • use NLWS.nmsDelivery.load(primary_key) to load delivery object
  • change on the sender information
    • delivery.mailParameters.senderName for name
    • delivery.mailParameters.senderAddress for address
    • delivery.mailParameters.replyAddress for reply address
    • delivery.mailParameters.replyName for reply name
  • use delivery.save() to save it

example

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

for each (var w in results.getElements("query")){
  delivery = NLWS.nmsDelivery.load(w.getAttribute('id'));
  delivery.mailParameters.senderEmail ="newemail@example.com";
  ..
  ..
  ..
  delivery.save();
}
   

query - in results.getElements('query') is the internal name of the query activity that is used to get all delivery templates

 

 

Marcel Szimonisz

MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/

View solution in original post

3 Replies

Avatar

Employee Advisor

Why would that info be in the XML memo?

In general it would not be in that field unless your instance has been customized.

 

Generally speaking you can just use personalization scripts in the Sender and Reply fields. Note you can only change the text and anything before the "@". You can't change the subdomain here.

 

so your From Sender and even reply to info could look like

From <% personalization.field>, <% personalization.field>@mypreConfiguredSubdomain.com

 

For more information: https://experienceleague.adobe.com/docs/campaign-classic/using/sending-messages/key-steps-when-creat...

notice the personalization icons on the right. they will let you select certain schema. Also possible to populate temp tables in the workflow and dynamically pull those in too.

David_Loyd_0-1666801712179.png

 

Avatar

Correct answer by
Community Advisor

Hello @MariaKonstantinova1995 ,

if you want to programatically change sender information you need to create workflow where

  • query all delivery templates
  • in JS activity query the results from temp:query
  • loop over all templates
  • use NLWS.nmsDelivery.load(primary_key) to load delivery object
  • change on the sender information
    • delivery.mailParameters.senderName for name
    • delivery.mailParameters.senderAddress for address
    • delivery.mailParameters.replyAddress for reply address
    • delivery.mailParameters.replyName for reply name
  • use delivery.save() to save it

example

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

for each (var w in results.getElements("query")){
  delivery = NLWS.nmsDelivery.load(w.getAttribute('id'));
  delivery.mailParameters.senderEmail ="newemail@example.com";
  ..
  ..
  ..
  delivery.save();
}
   

query - in results.getElements('query') is the internal name of the query activity that is used to get all delivery templates

 

 

Marcel Szimonisz

MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/

Hi Marcel!

 

Thanks for your answer. 

It's very helpful.

This is my script, it's working correctly.

 

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

for each (var res in results.getElements("query2")){
delivery = NLWS.nmsDelivery.load(res.getAttribute('id'));
delivery.mailParameters.senderAddress="TEST@example.com";
delivery.save();
}