Get and Set DDP's in Groovy Script(Part-1)

This blog demonstrates how to Get and Set DDP's in Groovy Script

Get and Set DDP's in Groovy Script(Part-1)

In this blog, we will see how to get and set dynamic document properties in groovy script and retrieve them in Boomi process.

What is Dynamic Document Property?

These are key/value pairs which can be set at document level. It can be set within certain scope and not in the entire process. The value which is set in Dynamic document property can be used only in one branch. We cannot persist the value in Dynamic Document property. To retrieve a dynamic document property, we must remember its name and type it in the field, function or script that we are using. There is no limit to set Dynamic document Properties.

In this Use Case,

  • We will set two Dynamic Document Properties named as “First” and “Second” in set properties shape with static values as 5 and 1.
  • In Groovy Script, we would fetch the value of these dynamic document properties, will add them and assign the output to a new Dynamic Document Property named "sum" .

 

Now, let us see the steps to get and set dynamic process property in groovy script and retrieve in Boomi.

Step 1:

Log on to Boomi platform (https://platform.boomi.com/) with required credentials i.e. Email Address and Password.

 

Step 2:

Once logged into Boomi platform, we will be able to view Home page.

 

Step 3:

Now, click on Services followed by Integration. We will see the Build page. Click on New.

 

Step 4:

Once, clicked on New, we will be able to see three fields i.e. Type, Component Name and Folder.

 

  • Select Type as process as we are building a process. Component Name and Folder can be given based on your choice (i.e which name to be given and where do we want to create the process). Click on create.

 

Step 5:

We see that the process gets created with a start shape which is configured with AS2 Shared Server by default.

 

Step 6:

Select the start shape and choose No Data. Click ok.

 

Step 7:

Search for Set Properties shape in search pallet. Drag and drop the shape onto process canvas and place it after start shape.

Step 8:

We will now create dynamic document properties in set properties shape.

  • Let us create by selecting the set properties shape and click on + symbol as shown.

 

 

  • Choose Dynamic Document Property from drop down.

 

 

  • Give the property name as “First” and click ok.

 

 

 

  • Now, we have to set parameter for Dynamic Document Property.  Select Dynamic Document property and choose + on parameters

 

 

  • We will have to set Type and static values in parameters. Here, we are selecting Type as Static from drop down and Static Value would be 5. Click ok.

 

 

 

  • After setting the value for Dynamic Document Property, it looks like as follows.

 

 

  • Now, let us create second Dynamic Document Property by following the same steps from Step 8. Give name of Dynamic Document Property as “Second” and set the static value to 1.

  •  After setting the values, it looks like as follows.

 

  • Click ok.

 

Step 9: To write a Groovy Script, drag and drop Data Process shape onto the process canvas and click ok.

Step 10: Select data process shapeand click +.

 

  • Choose Process Type as custom scripting from the drop down. Click on edit.

 

 

 

What's Your Reaction?

like
0
dislike
0
love
0
funny
0
angry
0
sad
0
wow
0