Boomi Dynamic Document Property

By in ,
1746
Boomi Dynamic Document Property

Document properties:

Document properties are variables/properties that keep metadata for each document that flows through the Boomi process. These document properties can be set or retrieved during the process execution.

Boomi DDP - Options

Dynamic Document Property:

Dynamic document properties (DDP) are used during the process flow to temporarily store additional details regarding a document. It can be used during runtime to capture and use the document values.

Dynamic Document Properties can be set/retrieved by

  • Using Set Properties Shape
  • Inside Map Function to Get/Set properties value
  • Using Groovy Script inside Map function/Data Process Shape

Set properties Shape:

DDP values can be set and retrieved dynamically using the Set Properties shape.

Boomi DDP - Set Properties Shape

Value can be retrieved from the Dynamic Document property

*Note: Default value can be used if no value is defined during Dynamic document property retrieval.

Boomi DDP - Default Value

Inside map Function:

Inside Boomi map function, these properties can be set/get to help business transformations.

Boomi DDP - Map Function

Using Groovy Scripting:

Boomi supports the use of both JavaScript and Groovy to help with complex business rules and transformations. This scripting can be used in a Data Process shape or inside a Boomi Map. These user-defined DDPs can be get/set inside the groovy script that helps pass variables from the boomi process to be used inside scripting. It uses below functions

  • getproperty() – Used to get Dynamic document property value in String format
  • setProperty() – Used to assign String value to DDP.

*Note: Dynamic Document Properties are user defined and it should be prefixed with “document.dynamic.userdefined” in order to refer these inside groovy scripting.

Get/Set Dynamic Document Property inside Groovy:

//Java Class libraries
import java.util.Properties;
import java.io.InputStream;

for( int i = 0; i < dataContext.getDataCount(); i++ ) {
     // Read Input data stream and corresponding properties
     InputStream is = dataContext.getStream(i);
     Properties props = dataContext.getProperties(i);
 
     // Get string value for Userdefined DDP -> DDP_Test_Value
     testValue = props.getProperty(“document.dynamic.userdefined.DDP_Test_Value “);
 
     // Set string value for Userdefined DDP -> DDP_Test_Value
     props.setProperty(“document.dynamic.userdefined.DDP_Test_Value “,”HELLO”);
 
     // Both Input Stream along with properties are written back to stream
     dataContext.storeStream(is, props);
}

References:

  • Details about Boomi Properties types can be found here

Cover Photo by Wesley Tingey on Unsplash