The idea of creating this example is to help you get familiar with the Talend MDM Before Saving process and show you how to use a Before Saving process to validate data changes in Talend MDM.
A process in Talend MDM defines one or multiple steps to perform business validation, data integration, data transformation, etc. A Before Saving process works with a specific entity and validates the entity data according to certain conditions before saving the data in the MDM Hub. It is automatically called back right before MDM saves the record. For more information about the process and the Before Saving process, see the section Processes in Talend Studio User Guide.
The Before Saving process beforeSaving_Product in Talend MDM demo project has been designed to validate any price change of a product before saving it in the MDM hub. This process uses the callJob plugin that calls the Job ValidatePriceChange created in the Integration perspective to validate the price change. For more information about how to create a callJob Before Saving process, see Setting up a callJob Process chain for a Before Process.
The Job ValidatePriceChange validates that the price does not
increase or drop by more than 15%. When the price increases or drops by more than 15%,
it will return an error message
increase of/drop of [change ratio] not allowed,
max is 15% that is defined in the tMap component with the label
CheckRatio and the new price value will not be saved, or
else, it will return an info message Product validation OK that
is defined in the tMap component with the label SetResult and the
new price will be successfully saved.
Before you begin
- The Talend IAM (Talend Identity and Access Management), TAC (Talend Administration Center), MDM server and Talend Studio have been successfully installed and started.
- The value of the context variable host and port in the Contexts view has been updated in the Integration perspective of Talend Studio if the MDM server is not installed locally and if you did not choose the default port number 8180 during the installation.
- At least the following Talend MDM demo project items, the Data Container Product, the Data Model Product, the Process beforeSaving_Product, the Job ValidatePriceChange, the View Product, the Role Demo_Manager and Demo_User, and the eleven images under the folder Resource in Talend Studio repository have been deployed to the MDM server successfully.
- The Job CreateUsers in Talend Studio has been executed successfully, and three MDM users have been created in Talend Administration Center and specific custom roles have been assigned to them.
- The Job MDM_LoadAll in Talend Studio has been executed successfully and the sample data has been loaded into the entity ProductFamily and Product.
For more information about the prerequisites, see Making the MDM demo project work.
About this task
- Log into Talend MDM Web UI with the user name firstname.lastname@example.org and the password manager, who has the write access to the Price element in the Product entity.
On the Master Data Browser page, open the product data
record for which you want to change price. In this example, it is the product
Talend Dog T-Shirt, whose price is
- In the Price field on the data record page, enter a new price value for the product Talend Dog T-Shirt. In this example, it is 18 which will not increase the price by 15%.
Click Save to save the change.
An informational message Product validation OK will be displayed and you will find the price is successfully changed to 18.
- In the Price field on the data record page, enter another new price value for the product Talend Dog T-Shirt. In this example, it is 36 which will increase the price by 100%.
An error message dialog box, which shows you the price change is not allowed, will be displayed.
Click OK to close the error message dialog box.
You will find the new price 36 was not saved.