How can I get a field in the delivery to have the same value as the one I have set in the campaign? | Community
Skip to main content
yansu
Level 2
August 10, 2023
Solved

How can I get a field in the delivery to have the same value as the one I have set in the campaign?

  • August 10, 2023
  • 3 replies
  • 1734 views

Hi,

 

I have created a new field in my campaign to which I will add a value. What I want to achieve is that when I add a delivery that field is kept with the same value that I put in the campaign.

 

Regards

 

@_manoj_kumar_  @parthasarathy @parvesh_parmar @davidkangni  

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 ParthaSarathy

@yansu , any field is fine.

Use the same script, but Replace the below @intenalName and @start with your campaign attribute, like expr="@campaignField1" expr="@campaignField2"

<node expr="@internalName"/><node expr="@start"/>

and inside for each loop, modify delivery.deliveryCode with delivery.deliveryNewAttribute

delivery.deliveryCode = eventT.@start;

To be clear, If you create 2 new attribute in campaign as @campaignField1 and @campaignField2

And create 2 new attribute in delivery as @deliveryField1 and @deliveryField2,

The script should be like,

var query = xtk.queryDef.create(<queryDef schema="nms:operation" operation="select"><select><node expr="@id"/><node expr="@campaignField1"/><node expr="@campaignField2"/></select> <where><condition expr={"@id = '"+instance.operation_id+"'"}/></where> </queryDef>); var eventExistss = query.ExecuteQuery(); for each (var eventT in eventExistss.operation) { delivery.deliveryField1 = eventT.@campaignField1; delivery.deliveryField2 = eventT.@campaignField2; }

 

Note: This value will be reflected in delivery schema, and delivery created.

But in Campaign UI, while editing the delivery, or in delivery activity, these values wont get reflect in activity.

3 replies

CampaignerForLife
Level 5
August 10, 2023

You should go to the data schema and modify the attribute adding this:

expr="[operation/attribute]" 

This will automatically add the operation/attribute value to the attribute you add the expression to. 

 

If your attribute is in another node, move around the nodes using "[../operation/attribute]". The ".." will make you go to the next upper node. 

 

Regards, H. 

yansu
yansuAuthor
Level 2
August 10, 2023

Hi,

 

it didn't work

 

this is my xml: 
<input colspan="2" label="Campo 1" readOnly="true" xpath="operation/@start" name="proof"/>
<set expr="operation/@start" xpath="prueba"/>

 

thank you in advance

LakshmiPravallika
Community Advisor
Community Advisor
August 10, 2023

Hi @yansu ,

 

For Example,If you are adding a field to the Campaign Dashboard Edit Tab and trying to add the value there it can be as shown below and try adding value to it

 

 

In the Delivery activity, Please call this field as "<%= message.delivery.operation.product_id %> "

 

Also, if you want to add a value to a query attribute , you can add alias to it as shown below and call it in your delivery activity

Example field added in query activity

 

In Delivery

 

Regards,

Pravallika.

 

 

 

ParthaSarathy
Community Advisor
Community Advisor
August 10, 2023

Hi @yansu ,

Considering the example, if you want to add campaign's 'start date' field value as Delivery's 'Delivery code' field,

Right click the delivery activity > script tab, paste the below script and run the Campaign WKF.

var query = xtk.queryDef.create(<queryDef schema="nms:operation" operation="select"><select><node expr="@id"/><node expr="@internalName"/><node expr="@start"/></select> <where><condition expr={"@id = '"+instance.operation_id+"'"}/></where> </queryDef>); var eventExistss = query.ExecuteQuery(); for each (var eventT in eventExistss.operation) { delivery.deliveryCode = eventT.@start; }

Add your campaign attribute in the select tag, eg, <node expr="@end"/>

And modify delivery.deliveryCode with your attribute,

eg, delivery.yourDeliveryAttribute  = eventT.@end;

RESULT:

 

 

~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
yansu
yansuAuthor
Level 2
August 10, 2023

Hi

 

I think I have not explained well.... As an example I am testing it with dates but later I want it to be any other data, then what I want to achieve is that this data entered in the campaign is displayed in the new test fields that I created when adding the delivery to the campaign

 

 


Thank you in advance

ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
August 10, 2023

@yansu , any field is fine.

Use the same script, but Replace the below @intenalName and @start with your campaign attribute, like expr="@campaignField1" expr="@campaignField2"

<node expr="@internalName"/><node expr="@start"/>

and inside for each loop, modify delivery.deliveryCode with delivery.deliveryNewAttribute

delivery.deliveryCode = eventT.@start;

To be clear, If you create 2 new attribute in campaign as @campaignField1 and @campaignField2

And create 2 new attribute in delivery as @deliveryField1 and @deliveryField2,

The script should be like,

var query = xtk.queryDef.create(<queryDef schema="nms:operation" operation="select"><select><node expr="@id"/><node expr="@campaignField1"/><node expr="@campaignField2"/></select> <where><condition expr={"@id = '"+instance.operation_id+"'"}/></where> </queryDef>); var eventExistss = query.ExecuteQuery(); for each (var eventT in eventExistss.operation) { delivery.deliveryField1 = eventT.@campaignField1; delivery.deliveryField2 = eventT.@campaignField2; }

 

Note: This value will be reflected in delivery schema, and delivery created.

But in Campaign UI, while editing the delivery, or in delivery activity, these values wont get reflect in activity.

~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups