PDI · Question #46
A business has a proprietary Order Management System (OMS) that creates orders from their website and fulfills the orders. When the order is created in the OMS, an integration also creates an order re
The correct answer is A. Ensure that the order number in the OMS is unique. D. Write a before trigger on the order object to delete any duplicates.. To prevent duplicate order records from being created in Salesforce by an external system, ensure the OMS provides unique order numbers and implement a before insert trigger in Salesforce to block duplicate insertions.
Question
A business has a proprietary Order Management System (OMS) that creates orders from their website and fulfills the orders. When the order is created in the OMS, an integration also creates an order record in Salesforce and relates it to the contact as identified by the email on the order. As the order goes through different stages in the OMS, the integration also updates It in Salesforce. It is noticed that each update from the OMS creates a new order record in Salesforce. Which two actions will prevent the duplicate order records from being created in Salesforce? Choose 2 answers
Options
- AEnsure that the order number in the OMS is unique.
- BUse the order number from the OMS as an external ID.
- CUse the email on the contact record as an external ID.
- DWrite a before trigger on the order object to delete any duplicates.
How the community answered
(17 responses)- A59% (10)
- B18% (3)
- C24% (4)
Why each option
To prevent duplicate order records from being created in Salesforce by an external system, ensure the OMS provides unique order numbers and implement a `before insert` trigger in Salesforce to block duplicate insertions.
Ensuring that the order number generated by the OMS is unique is a fundamental data quality requirement. If the source system itself guarantees uniqueness, it simplifies the process for Salesforce to reliably identify and prevent duplicate records.
While using the order number from the OMS as an External ID is crucial for matching, merely designating a field as an External ID does not, by itself, prevent duplicate inserts unless the field is also marked as `Unique` in the schema definition, or the integration uses an `upsert` operation.
Using the email on the contact record as an external ID would help identify or relate contacts, but it has no bearing on uniquely identifying or preventing duplicate *order* records.
A `before insert` trigger on the Order object can query for existing orders with the same OMS order number. If a duplicate is detected, the trigger can prevent the new record from being inserted (e.g., by calling `addError()` on the incoming record), thus preventing the creation of a duplicate.
Concept tested: Preventing Duplicate Record Creation in Integrations
Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_insert_events.htm
Topics
Community Discussion
No community discussion yet for this question.