In this article, we'll illustrate how to manage a "Material" attribute at the "Product Color" level from a "Material" attribute already present at the "Product" level.
We will present three different methods for achieving this objective.
Context
Let's assume that
the data model comprises two entities: "Product" and "Product Color";
the "Material" attribute is initially filled in at the "Product" level by a user.
you wanted to be able to view this material at the "Product Color" level.
Solutions
Preparation
It is necessary to create a "Material" attribute at the "Product Color" level, which will host the values of the "Material" attribute at the "Product" level.
This attribute must be non-editable, as it is a copy. In fact, the master data remains managed at the "Product" level.
Method 1: Export / Import
Steps
Export data
Export products with a join to color products.
The exported file will contain product data and associated color products.File modification
If necessary (not compulsory), delete all columns except those containing the code of Color Product documents and material data.Re-import data
Prepare an import with the exported file.
Map the "product-material" column to the "product-color-material" attribute in the exported file.
Launch import
Your "Products" data has now been imported into "Product-Colors".
Advantage
The imported file appears in the activity table, allowing easy monitoring and verification.
Disadvantages
Data is copied with a delay predetermined by the script orchestration (e.g. every hour).
Can it be automated?
This method can be automated via :
API
Automation platforms such as Make.com or Zapier
Method 2: Using the API to copy data
Steps
Retrieve modified "Products"
Use the GET /documents API with a filter onthe "Product" document type
update date to retrieve products that have been modified within a certain period of time
Retrieve associated "Product Color"
Use thelinks
resources from the response payload to obtain the "Product Color" codes.Updating "Product Color"
Use the
PUT /documents/xxx
API to update the "product-color-matter" attribute of the "Product Color" concerned.
Benefits
This method enables fine-tuned management of updates based on recent modifications.
Disadvantages
Data is copied with a delay predetermined by the script orchestration (e.g. every hour).
All updated "Product" documents are scanned, even if the "Material" attribute has not been modified.
Method 3: Using Webhook Notifications
Steps
Setting up notifications
Set up a webhook to be notified in real time of document modifications.Handling notifications
Use the
GET /documents/xxx
API to retrieve the "Product" when a notification is received indicating that :the document type is "Product
the "Material" attribute has been modified
Updating "Color Products"
Use thelinks
resources from the response payload to obtain the "Product Color" codes.
Then update the "product-color-material" attribute of each "Color Product".
You will find attached the "make.com" blueprint that can be imported.
Benefits
Data is updated in near-real time.
Only relevant events are processed.
Disadvantages
Requires an HTTP server to host notifications.
Tools such as Make.com or Zapier can make this easier.
Conclusion
Each of these methods has its own advantages and disadvantages.
The choice of method will depend on your organization's specific needs in terms of update time and implementation complexity.
For near-instant synchronization and precise event management, the webhook notification method is recommended.
For less urgent needs, export/import or API methods may be sufficient.