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.
Standard Document property:
Boomi run-time maintains a set of document properties for each document that comes out of connector shape to keep track of metadata specific to that connector / Trading partner object. These properties are used for tracking the document and cannot be modified. These properties are referred to as Document properties aka standard document properties. Boomi run-time categorizes these properties as
- Trackable – These properties carry info out of the inbound connector object/trading partner. These can be used in the process flow but cannot be modified. i.e., Reading a File Name from an inbound document through a Disk connector.
- Dynamic – These document properties are set before the outbound connector call/trading partner i.e., Setting File Name and Directory before outbound Disk shape.
Below are the source types of standard document properties supported in Boomi
- Connector Properties – Carries information related to the connector object. E.g., Disk File name, directory, FTP file name, Mail From and To address, etc.,
- Trading Partner Properties – Enabled only in the Advanced Integration flow. It carries information related to Interchange, Functional Group, and Transaction Set.
- Meta Data – Information related to some process shapes once the document successfully passes through those shapes. E.g., Application status code & message, Try/catch exception Message, Business rules result message, cleanse result message, etc.,
Like other properties, these properties can be set and 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:
Using the Set Properties shape, these document properties can be retrieved after an inbound connector call and can be defined before an outbound connector call
Mail Connector -> Trackable properties like From address, To address, Subject, etc.,
Disk Connector -> Trackable property File Name.
Inside map Function:
Inside the Boomi map function, these properties can be set/get to help business transformations.
Using Groovy Scripting:
Boomi supports the use of both JavaScript and Groovy to help with complex business logic and transformations. This scripting can be used in a Data Process shape or inside a Boomi map. To make the business changes easier, these properties can be obtained and changed within the groovy script. Below functions can be used inside groovy to get/set these parameters.
- getProperty() – Used to get document property value in String format.
- setProperty() – Used to assign String value to a document property.
*Note: These standard properties need to be prefixed with connector.track for tracking inbound properties and connector.dynamic for setting outbound properties
Get/Set Document Property inside Groovy:
//Java libraries
import java.util.Properties;
import java.io.InputStream;
for (int i = 0; i < dataContext.getDataCount(); i++) {
InputStream is = dataContext.getStream(i);
//Obtaining Properties object for a specific document instance i
Properties props = dataContext.getProperties(i);
// Obtaining FTP – File Name programatically
inputFileName = props.getProperty(“connector.track.ftp.filename”);
// Assigning outbound Mail – Subject programatically
props.setProperty(“connector.dynamic.mail.subject”, “Input file received – ”+ inputFileName);
//Storing the Stream along with modified properties
dataContext.storeStream(is, props);
}
References:
- Details about Boomi Properties types can be found here
Cover Image by Freepik