Changing an XML record in beforeSaving_xxx

Overview

Talend MDM (Master Data Management) provides a beforeSaving_xxx process to validate the data when you update a Talend MDM record. Furthermore, it is possible to change the XML record in beforeSaving_xxx by providing one special output variable, output_item. This article explains how to do it.

 

Environment

This procedure applies to Talend MDM v5.1.x or higher.

 

Resolution

In a beforeSaving_xxx process, there is a special output variable, output_report, used to show the update report message as in the formatted string below:

<report> <message type="info|error"> xxx report message xxx </message> </report>
  • info: validation OK.
  • error: validation failed.

There is another output variable, output_item, used to change the XML record as in the formatted string below:

<exchange> <item> xxx the updated xml record string xxx </item> </exchange>

Here is an example of how to change the XML record in a beforeSaving_xxx process:

The beforeSaving_Entity_3 process contains 2 steps: Change and Check.

 

  1. Change the step as below:

    change.png

  2. Check the step as below:

    check.png

 

Steps to reproduce the issue

  1. Import mdmitems.zip (attached) to the Studio, then deploy all items to MDM server.
  2. Import jobs.zip (attached) to the Studio, then deploy the 2 Jobs to the MDM server.
  3. Log in to the Web User Interface, create one Entity_3 record, and save it.
  4. Update Field_2 and Field_3, then Save. The Date will be updated with the value of the current time.

The files jobs.zip and mdmitems.zip are exported from Talend 5.3.1.

 

Related Jira Issues

TMDM-1816 - Let a before saving process alter the item before it is committed to the db - Closed

Version history
Revision #:
7 of 7
Last update:
‎05-05-2017 09:55 AM
Updated by:
 
Labels (1)