pfx-api:execute

pfx-api:execute

Execute a Pricefx formula. Formulas are server-side logic units that can be invoked by SKU or formula name.

URI Format

pfx-api:execute?param1=value1&param2=value2

Parameters

Parameter

Type

Default

Description

sku

String

--

SKU to execute the formula against. Either sku or formulaName must be provided

formulaName

String

--

Name of the formula to execute. Either formulaName or sku must be provided

mapper

String

--

Name of the mapper bean used to transform data before sending to Pricefx

XML Route Examples

Execute a formula by name

XML
<route>
    <from uri="direct:executeFormula"/>
    <to uri="pfx-api:execute?formulaName=MyFormula"/>
</route>

Execute a formula for a specific SKU

XML
<route>
    <from uri="direct:executeForSku"/>
    <to uri="pfx-api:execute?sku=PROD-001"/>
</route>

Execute a formula with a mapper

XML
<route>
    <from uri="direct:executeWithMapper"/>
    <to uri="pfx-api:execute?formulaName=MyFormula&amp;mapper=formulaInputMapper"/>
</route>

Execute a formula with both SKU and name

XML
<route>
    <from uri="direct:executeFormulaFull"/>
    <to uri="pfx-api:execute?formulaName=PriceCalculation&amp;sku=PROD-001&amp;mapper=formulaMapper"/>
</route>

Common Pitfalls

  • sku or formulaName required: At least one of sku or formulaName must be provided. Without either, the component does not know which formula to execute.

  • Mapper usage: The mapper parameter is optional but useful when the formula expects structured input. The mapper transforms the exchange body before sending it to the Pricefx API.

  • Formula must exist on server: The formula identified by formulaName or sku must already exist in the Pricefx partition. A missing formula will result in an API error.

  • Return value: The formula execution result is placed in the exchange body. The structure of the result depends on the formula implementation on the Pricefx side.