Working with mdm_context - 6.3

Talend Data Fabric Studio User Guide

English (United States)
Talend Data Fabric
Talend Studio
Data Quality and Preparation
Design and Development

As a Java object, it can be used in Groovy expressions everywhere in the workflow editor, such as in forms, to populate widgets or to control user entries. For more information on working with Groovy, see

A Javadoc for the MDMContext class is available in the Eclipse help, under Talend MDM > API Reference.

Adding the mdm_context variable

The mdm_context variable is created automatically both when you design a workflow using the workflow wizard and when you design a workflow from scratch, but you will need to create it yourself for an Entity Action Process.

To add the mdm_context variable manually, do the following:

  1. In the BPM perspective, click in the workflow pool and then, in the Data view, click the Pool variables tab.

  2. In the Process variables area, click the Add button.

  3. In the window that opens, define the parameters of the variable as follows:

    • Name: mdm_context

    • Data type: Java Object

    • Class: Click the Browse button, start typing MDMContext in the selection field, click this class to select it once it appears in the list of classes proposed, and then click OK.

  4. Click Finish to validate your changes.

Using mdm_context with custom form widgets

Form designers can build expressions associated with each widget to perform specific actions in the MDM database. This section shows how mdm_context can be used to facilitate this task. The example shows how to populate a widget with its initial value using a getValue method.

Getting initial values for a text field

This example shows how to use the mdm_context.getValue method to obtain the initial values for a text field in a widget.

  1. In your workflow, select the step for which you want to build the expression.

    Click the 6.x Application tab, and then click Pageflow to open the corresponding view.

  2. Double-click the form name, RequestNewPrice in this case, to open it in the workspace.

    If the form does not exist, click the Add button to create it and then drag a Text field widget to the form.

  3. Select the Text field widget and then, in the Data tab under the General view, click in the Initial value field and then click the Edit button.

  4. In the dialog box that opens, select Script from the Expression type list.

    Next, enter a name in the Name field, and then enter the expression mdm_context.getValue("Product/Price") in the editor.

    This is an expression which populates the text field with the value taken from the XPath entered between double quotes, Product/Price in this case.

  5. Click OK.

    The name of the expression is shown in the Initial value field. When a user opens the form, this field will now be populated with the relevant data.