pfx-api:integrate
Upsert data into Pricefx using business-key matching. Existing records that match are updated; new records are inserted. Supports conditional updates.
Overview
The integrate method is the upsert operation for Pricefx. It compares incoming data against existing records using business keys:
-
If a matching record is found, it is updated
-
If no matching record is found, a new record is inserted
-
Optionally, a condition can restrict which existing records are updated
This is the preferred method when you need to keep Pricefx in sync with an external system without truncating and reloading.
URI Format
pfx-api:integrate?objectType=P&mapper=productIntegrateMapper&businessKeys=sku
Parameters
|
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
(required) |
Target Pricefx object type. |
|
|
|
-- |
Name of the integrate mapper bean. The mapper must implement |
|
|
|
(required) |
Comma-separated business key field names used for matching. |
|
|
|
-- |
Name of a condition filter bean. Only existing records that match this condition are updated. Records that do not match are skipped (not deleted). |
|
|
|
-- |
Pricefx connection bean name. |
|
|
|
-- |
Data auto-conversion strategy: MANUAL, AUTO. |
integrateMapper
The integrate method uses an IntegrateMapper (not a LoaddataMapper). The integrate mapper defines which fields to map and how to handle updates vs inserts.
<pfx:integrateMapper id="productIntegrateMapper">
<pfx:field from="SKU" to="sku"/>
<pfx:field from="PRODUCT_NAME" to="label"/>
<pfx:field from="PRICE" to="attribute1"/>
</pfx:integrateMapper>
You can override the mapper at runtime by setting the integrateMapperPfx header on the exchange.
Condition
The condition parameter references a filter bean. When set, only existing records that match the condition are eligible for update. This is useful for:
-
Only updating records that have not been manually modified
-
Only updating records in a specific status
-
Protecting certain records from being overwritten
<pfx:filter id="notManuallyEdited">
<pfx:criterion fieldName="attribute10" operator="notEqual" value="MANUAL"/>
</pfx:filter>
<to uri="pfx-api:integrate?objectType=P&mapper=productIntegrateMapper&businessKeys=sku&condition=notManuallyEdited"/>
Examples
Integrate Products (P)
<route>
<from uri="direct:integrateProducts"/>
<to uri="pfx-api:integrate?objectType=P&mapper=productIntegrateMapper&businessKeys=sku"/>
</route>
Integrate Product Extensions (PX)
<route>
<from uri="direct:integratePX"/>
<to uri="pfx-api:integrate?objectType=PX&mapper=pxIntegrateMapper&businessKeys=sku"/>
</route>
Integrate Lookup Table Values (LTV)
<route>
<from uri="direct:integrateLTV"/>
<to uri="pfx-api:integrate?objectType=LTV&mapper=ltvMapper&businessKeys=name&pricingParameterName=MyLookupTable"/>
</route>
Integrate Matrix Lookup Table Values (MLTV)
<route>
<from uri="direct:integrateMLTV"/>
<to uri="pfx-api:integrate?objectType=MLTV&mapper=mltvMapper&businessKeys=key1,key2&pricingParameterName=MyMatrixTable"/>
</route>
Integrate with Condition
<pfx:filter id="onlyActiveRecords">
<pfx:criterion fieldName="attribute5" operator="equals" value="ACTIVE"/>
</pfx:filter>
<route>
<from uri="direct:conditionalIntegrate"/>
<to uri="pfx-api:integrate?objectType=P&mapper=productIntegrateMapper&businessKeys=sku&condition=onlyActiveRecords"/>
</route>
Headers
Consumed
|
Header |
Type |
Description |
|---|---|---|
|
|
|
Overrides the mapper for this invocation. |
Common Pitfalls
-
Using LoaddataMapper instead of IntegrateMapper -- The
integratemethod requires anIntegrateMapper, not aLoaddataMapper. Using the wrong mapper type will cause a class cast error. -
Missing businessKeys -- Business keys are required for integrate. Without them, the component cannot match incoming data to existing records.
-
Condition misunderstanding -- The condition only controls which existing records are updated. It does not prevent inserts. New records (no matching business key) are always inserted regardless of the condition.
-
Performance vs loaddata --
integrateis slower thanloaddatabecause it must check each record against existing data. For initial loads or full refreshes where you can truncate first, preferloaddatafor better performance. -
Business key mismatch -- The business key field names must match the fields in the Pricefx object. For example, Products use
sku, Customers usecustomerId. Using the wrong field name will result in all records being treated as new inserts.