Import Sellers (SL) and Seller Extensions (SX)

Import Sellers (SL) and Seller Extensions (SX)

Overview

Import seller (sales representative) data into Pricefx Sellers (object type SL) and Seller Extensions (object type SX). Sellers represent the sales team members who create quotes and manage customer relationships.

Seller Import (SL)

routes/import-sellers.xml

XML
<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="import-sellers">
        <from uri="file:{{import.sellers.directory}}?{{archive.file}}&amp;{{read.lock}}"/>
        <log message="Starting seller import: ${header.CamelFileNameOnly}" loggingLevel="INFO"/>
        <to uri="pfx-csv:streamingUnmarshal?skipHeaderRecord=true&amp;useReusableParser=true"/>
        <to uri="pfx-api:loaddataFile?objectType=SL&amp;mapper=import-sellers.mapper&amp;batchSize=200000"/>
        <log message="Seller import completed: ${header.CamelFileNameOnly}" loggingLevel="INFO"/>
    </route>
</routes>

mappers/import-sellers.mapper.xml

XML
<mappers>
    <loadMapper id="import-sellers.mapper">
        <body in="sellerId" out="sellerId"/>
        <body in="sellerName" out="label"/>
        <body in="email" out="attribute1"/>
        <body in="region" out="attribute2"/>
        <body in="territory" out="attribute3"/>
        <body in="managerId" out="attribute4"/>
        <body in="department" out="attribute5"/>
    </loadMapper>
</mappers>

Test CSV: test-data/sellers.csv

sellerId,sellerName,email,region,territory,managerId,department
SELLER-001,John Smith,john.smith@example.com,EMEA,Western Europe,MGR-001,Enterprise Sales
SELLER-002,Jane Doe,jane.doe@example.com,NA,East Coast,MGR-002,SMB Sales
SELLER-003,Bob Wilson,bob.wilson@example.com,APAC,Australia,MGR-001,Enterprise Sales

Seller Extension Import (SX)

routes/import-seller-extensions.xml

XML
<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="import-seller-extensions">
        <from uri="file:{{import.sx.directory}}?{{archive.file}}&amp;{{read.lock}}"/>
        <log message="Starting seller extension import: ${header.CamelFileNameOnly}" loggingLevel="INFO"/>
        <to uri="pfx-csv:streamingUnmarshal?skipHeaderRecord=true&amp;useReusableParser=true"/>
        <to uri="pfx-api:loaddataFile?objectType=SX&amp;mapper=import-seller-extensions.mapper&amp;batchSize=200000"/>
        <log message="Seller extension import completed: ${header.CamelFileNameOnly}" loggingLevel="INFO"/>
    </route>
</routes>

mappers/import-seller-extensions.mapper.xml

XML
<mappers>
    <loadMapper id="import-seller-extensions.mapper">
        <constant expression="Targets" out="name"/>
        <body in="sellerId" out="sellerId"/>
        <body in="quarter" out="attribute1"/>
        <body in="salesTarget" out="attribute2" converterExpression="stringToDecimal"/>
        <body in="commissionRate" out="attribute3" converterExpression="stringToDecimal"/>
        <body in="territory" out="attribute4"/>
    </loadMapper>
</mappers>

Key Differences from Products/Customers

Aspect

SL (Seller)

SX (Seller Extension)

Key field

sellerId

sellerId + table name

Table name in mapper

Not needed

<constant expression="TableName" out="name"/> required

Object type

SL

SX

Attributes

attribute1-attribute30

attribute1-attribute30

config/application.properties

# Seller import directories
import.sellers.directory=/data/imports/sellers
import.sx.directory=/data/imports/seller-extensions

How It Works

  1. File Pickup: file: monitors the configured directory. {{archive.file}} archives processed files. {{read.lock}} ensures files are fully written.

  2. Streaming Parse: pfx-csv:streamingUnmarshal parses CSV without loading the full file.

  3. Upload: pfx-api:loaddataFile streams data to Pricefx. objectType=SL for sellers, objectType=SX for seller extensions.

  4. SX Table Name: Like PX/CX, seller extensions require <constant expression="TableName" out="name"/> in the mapper.

Common Pitfalls

  • sellerId is the key field: Not sku or customerId. Sellers have their own unique identifier.

  • SX requires table name constant: Same as PX/CX -- the mapper MUST include <constant expression="TableName" out="name"/>.

  • Seller must exist for SX: Seller extension records reference an existing seller by sellerId. Import sellers (SL) before their extensions (SX).

  • No businessKeys for SL: Unlike Products, Seller imports do not typically use businessKeys. The sellerId field is the natural key handled by Pricefx internally.