Skip to main content Skip to complementary content

Validating a price change using the Before Saving process

Availability-noteDeprecated

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 Processes.

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.

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 defined in the tMap component with the label SetResult and the new price will be successfully saved.

Before you begin

  1. The Talend IAM (Talend Identity and Access Management), TAC (Talend Administration Center), MDM server and Talend Studio have been successfully installed and started.
  2. The value of the context variables host and port in the Context view have 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.
  3. 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.
  4. 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.
  5. 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

You can perform the following steps to get more familiar with the Talend MDM demo project Before Saving process and execute it:

Procedure

  1. Log into Talend MDM Web UI with the user name manager@mdm.company.com and the password manager, who has the write access to the Price element in the Product entity.
  2. 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 16.99.

    Example

  3. 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%.
  4. 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.

    Example

  5. 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%.
  6. Click Save.
    An error message dialog box, which shows you the price change is not allowed, will be displayed.

    Example

  7. Click OK to close the error message dialog box.
    You will find the new price 36 was not saved.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!