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

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

Avatar

Level 2

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  

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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.

View solution in original post

9 Replies

Avatar

Level 7

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. 

Avatar

Level 2

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

Avatar

Community Advisor

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

 

LakshmiPravallika_0-1691653919331.png

 

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

LakshmiPravallika_1-1691654005850.png

 

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

LakshmiPravallika_2-1691654096530.png

 

In Delivery

LakshmiPravallika_3-1691654129638.png

 

Regards,

Pravallika.

 

 

 

Avatar

Community Advisor

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

ParthaSarathy_0-1691656516326.png

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_2-1691656714432.png

 

ParthaSarathy_1-1691656612807.png

 

Avatar

Level 2

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

yansu_1-1691658291309.png

 

yansu_0-1691658272861.png

 


Thank you in advance

Avatar

Correct answer by
Community Advisor

@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.

Avatar

Community Advisor

@alnavarg , Only when the campaign workflow ran, and when a delivery gets created for it, in that created delivery's input form you can able to see the value gets reflected. But not on the delivery activity in the Workflow.