Expand my Community achievements bar.

SOLVED

TEST A/B javascript code

Avatar

Level 3

Hi,

 

I am trying to use the javascript code included in the documentation to get the winner in base of opens, and it is not working. Is anything wrong with it?

 

I will leave it here: https://experienceleague.adobe.com/docs/campaign-classic/using/sending-messages/a-b-testing/use-case... 

 

bcollado_0-1699972817435.png

I did a copy-paste, so if I am missing any step, please let me know!

Thank you very much as always

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@bcollado , Instead of using this Delivery activity (Star icon delivery which you had currently used), replace it with Recurring delivery activity and run the workflow. (Make sure you're creating this in a campaign workflow)

ParthaSarathy_1-1699977738012.png

 

Still If you want to use a Star icon Delivery (delivery2 and delivery3 of your workflow), then in its script tab, add the below code

 

delivery.operation_id = instance.operation_id;
delivery.workflow_id = instance.id;

 

ParthaSarathy_2-1699977855352.png

Amine has mentioned the same. You need to use this script in delivery's script tab.

Alternatively, you can also replace this activity with Recurring Delivery and no need of external script to be added.

View solution in original post

6 Replies

Avatar

Community Advisor

Hello @bcollado,

The reason why it's not working is that you used the delivery activity that call a delivery model. The generated deliveries are not linked to the workflow. 

Add the bellow script to the initialization script of your delivery activities.

it should link the created deliveries to the workflow and to the operation.

delivery.operation_id = instance.operation_id;
delivery.workflow_id = instance.id;

 Br,

Amine

Avatar

Level 3

Hi,

 

you mean like this?

 

bcollado_1-1699974434525.png

I do not understand properly when you say I have to link the created deliveries to the workflow and to the operation... need more details please and thanks!

Avatar

Community Advisor

Hi @bcollado ,

If you had followed and copied the same script from the documentation, edit the label of JavaScript activity and change it as <%= vars.deliveryId %> (as mentioned in point-3).

ParthaSarathy_0-1699975257737.png

 

Run the workflow again, and if you get any error, share the screenshot of error.

Avatar

Level 3

Hi!

 

it is not working as you can see in the picture

bcollado_0-1699976131798.png

Avatar

Correct answer by
Community Advisor

@bcollado , Instead of using this Delivery activity (Star icon delivery which you had currently used), replace it with Recurring delivery activity and run the workflow. (Make sure you're creating this in a campaign workflow)

ParthaSarathy_1-1699977738012.png

 

Still If you want to use a Star icon Delivery (delivery2 and delivery3 of your workflow), then in its script tab, add the below code

 

delivery.operation_id = instance.operation_id;
delivery.workflow_id = instance.id;

 

ParthaSarathy_2-1699977855352.png

Amine has mentioned the same. You need to use this script in delivery's script tab.

Alternatively, you can also replace this activity with Recurring Delivery and no need of external script to be added.

Avatar

Level 3

It is already fixed using the recurring deliveries, thanks a lot!

 

kind regards