Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Retrieve delivery code from javascript in a workflow?

SorenDahl
Level 2
Level 2

HI There!

I was wondering if it is possible to retrieve the delivery code of a deliveri in a workflow and assign it to a variable and afterwards update a table with the retrieved delivery code? 

I have this: 

SorenDahl_0-1616157825106.png

What I am in doubt of is, how can I retrieve the deliveryCode of the incoming delivery and store it as a variable to use when updating a table later on that we are using for analysing purposes? 

Also, is it even possible to do in a smart way? Would the 2 JS scripts overwrite the variable value in any case? If yes, then I would have to manually set it anyways, and it will not be very smart. 

I hope someone has insights to this 🙂 

 

delivery javascript js workflow
1 Accepted Solution
akashaj7696
Correct answer by
Level 3
Level 3

Hey,
This can be easily done. First open the delivery (i said open and not edit) and in there go to object modification script, where you can write vars.deliveryCode=delivery.deliveryCode. This will create an event variable with name deliveryCode and it will be dynamically updated with the value of the deliveryCode inside the delivery and then this event variable will flow through and can be used later.

Let me know if this is what you were looking for.

Thanks

Akash

View solution in original post

4 Replies
akashaj7696
Correct answer by
Level 3
Level 3

Hey,
This can be easily done. First open the delivery (i said open and not edit) and in there go to object modification script, where you can write vars.deliveryCode=delivery.deliveryCode. This will create an event variable with name deliveryCode and it will be dynamically updated with the value of the deliveryCode inside the delivery and then this event variable will flow through and can be used later.

Let me know if this is what you were looking for.

Thanks

Akash

View solution in original post

SorenDahl
Level 2
Level 2
Thanks @akashaj7696! That is definitely helpful! I can't seem to figure out how to use that defined variable in an enrichment activity step? Any pointers to how to use that defined variable in steps further down the workflow?
akashaj7696
Level 3
Level 3
You can click to add a new row in the output column and in the expression editor write $(vars/@deliveryCode).