CSR
The root node of the XML document.
Supported child nodes
Node | Description |
---|---|
Condition | Used to create a condition for a node to be valid |
ErrorOn | Contain logic for when no product can be selected |
Expressions | Change or apply data on fields |
Prices | Inline Price Calculation |
SelectRules | Logic if only one product is valid |
ServiceLevels | Logic if more than one product is valid |
GoodsTypeMappings | Logic to assign a Goods Type on a product |
ServiceMappings | Logic to assign service(s) on a product |
Supports the following attributes (1 = true, 0 = false)
- defaultservicelevel - If a ServiceLevel name is used, the default will be ignored.
- onsubmit - Activate CSR on submit
- showservicelevelsinpv - Allow the user to select ServiceLevels from PV
- userconfirm - Displays a confirmation message in PV
- nocache - Used when developing and testing the XML file
- useproductnamefromfile - Use the name attribute from Product node
- onimporttoinbox - Activate CSR on import without autoprint
- presubmit_event_validation - Enable PostCode / RoutingCode Lookup
- carriervalidation - Turn off carrier validation when CSR is executing. This is mostly used together with GetShipAdvise to make the validation of products faster. Besides 1 and 0, it is also possible to use one of the following settings:
- carriervalidation="light" - will skip validations from setup items but still run carrier validations.
- carriervalidation="superlight"- will only run carrier validations but no standard validations like sender and receiver country for a product, empty receiver name and postcode, etc.
Default settings for the attributes if not specified
<CSR defaultservicelevel="" nocache="0" showservicelevelsinpv="0"
onsubmit="1" userconfirm="0" carriervalidation="1"
useproductnamefromfile="0" onimporttoinbox="1"
presubmit_event_validation="0">
<ErrorOn/>
<Condition/>
<Prices/>
<SelectRules/>
<ServiceLevels/>
</CSR>
ErrorOn
Contain logic to handle cases where no product can be selected
Note: Only apply with the usage ServiceLevel node(s)
Supports the following attributes (1 = true, 0 = false)
- autoselectservicelevelfailed - fail if no service level could be found based on the entry product
- novalidproductsfound - fail if no valid product could be found in a ServiceLevel
- etawebservicefailed - fail if the call to ETA webservice fails (Can only be used together with the Shipment Server method PreAdviseOrder)
- noproductscandeliver - fail if no products can deliver within the requested delivery time (Can only be used together with the Shipment Server method PreAdviseOrder)
Default settings for the attributes if not specified
<CSR>
<ErrorOn autoselectservicelevelfailed="0"
novalidproductsfound="1"
etawebservicefailed="0"
noproductscandeliver="0"/>
</CSR>
SelectRules
SelectRules can be placed under the CSR and each ServiceLevels node.
They are used when you know which product should be selected given a condition.
Supported child nodes
Node | Description |
---|---|
SelectRule | Custom Validation |
Example
<CSR>
<SelectRules/>
<ServiceLevels>
<ServiceLevel>
<SelectRules/>
</ServiceLevel>
</ServiceLevels>
</CSR>
SelectRule
SelectRule is placed under the SelectRules node.
This node supports nesting so you can have multiple SelectRule inside another SelectRule.
Supported child nodes
Node | Description |
---|---|
SelectRule | Custom Validation |
Expressions | Apply custom data on field |
Product | The product to be selected if the validation is valid |
This node can be configured in different ways:
stringcompare (Only if the field contains the value from the comparestring)
<SelectRule name="stringcompare" comparestring="some_value"
equal="1" casesensitive="0" field="STRING_FIELDS"
custommessage="">
<Product/>
</SelectRule>
regex (Only if the field contains the value from the comparestring)
<SelectRule name="regex" comparestring="a_regex_expression"
equal="1" casesensitive="0" field="STRING_FIELDS"
custommessage="">
<Product/>
</SelectRule>
country (Only NO, SE is allowed)
<SelectRule name="country" allowcountries="NO,SE"
field="COUNTRY_FIELDS" custommessage="">
<Product/>
</SelectRule>
datelimits
<SelectRule name="datelimits" min="dd.MM.YYYY" max="dd.MM.YYYY"
field="DATE_FIELDS" custommessage="">
<Product/>
</SelectRule>
datetimelimits
<SelectRule name="datetimelimits"
min="dd.MM.YYYY hh:mm" max="dd.MM.YYYY hh:mm"
field="DATE_FIELDS" custommessage="">
<Product/>
</SelectRule>
timelimits
<SelectRule name="timelimits" min="hh:mm" max="hh:mm"
field="DATE_FIELDS" custommessage="">
<Product/>
</SelectRule>
intlimits
<SelectRule name="intlimits" min="0" max="1"
unit="UNITS" field="INT_FIELDS" custommessage="">
<Product/>
</SelectRule>
floatlimits
<SelectRule name="floatlimits" min="0.0" max="10.5"
unit="UNITS" field="FLOAT_FIELDS" custommessage="">
<Product/>
</SelectRule>
postcodevalidation - Range file - Type Numeric
<SelectRule name="postcodevalidation">
<PostcodeValidations>
<PostcodeValidation country="" exclude="1" type="numeric"
rangefile="file.txt"/>
</PostcodeValidations>
<Product/>
</SelectRule>
// file.txt
6400,6500
7400,8000
postcodevalidation - Range file - Type UK
<SelectRule name="postcodevalidation">
<PostcodeValidations>
<PostcodeValidation country="GB" exclude="1" type="UK"
rangefile="file.txt"/>
</PostcodeValidations>
<Product/>
</SelectRule>
// file.txt
NW9 0AA,
NW9 0AB,
NW9 0AC,
All postcodes starting with "NW9 0AA", "NW9 0AB", "NW9 0AC" will be excluded.
postcodevalidation - Inline - Type Numeric
<SelectRule name="postcodevalidation">
<PostcodeValidations>
<PostcodeValidation country="" exclude="1" type="numeric">
<Range min="6400" max="6500"/>
</PostcodeValidation>
</PostcodeValidations>
<Product/>
</SelectRule>
postcodevalidation - Inline - Type UK
<SelectRule name="postcodevalidation">
<PostcodeValidations>
<PostcodeValidation country="GB" exclude="1" type="UK">
<Range min="BA" max=""/>
<Range min="BN1" max=""/>
</PostcodeValidation>
</PostcodeValidations>
<Product/>
</SelectRule>
All postcodes starting with "BA" and "BN1" will be excluded.
ServiceLevels
The ServiceLevels node can only be placed under the CSR node.
You can have more than one ServiceLevel in the ServiceLevels node, making it possible to run different allocation rules on a collection of products and have multiple shipping processes.
Supported child nodes
Node | Description |
---|---|
ServiceLevel | Logic, if more than one product can be used |
Example
<CSR>
<ServiceLevels>
<ServiceLevel/>
</ServiceLevels>
</CSR>
ServiceLevel
Can only be placed inside a ServiceLevels node. The ServiceLevel contains a list of products.
Supported child nodes
Node | Description |
---|---|
Products | Contain the Product nodes |
Expressions | Change or apply data on fields |
SelectRules | Logic if only one product is valid |
ServiceLevel | Logic if more than one product is valid |
AllocationRules | How to allocate products |
Supports the following attributes
- name - the id of the ServiceLevel
- fallback - name of another ServiceLevel to target if no product can pass the validations
Example
<ServiceLevels>
<ServiceLevel name="" fallback="">
<SelectRules/>
<Products/>
<AllocationRules/>
</ServiceLevel>
</ServiceLevels>
Products
The Products contains a list of Product nodes, can only be placed once on each ServiceLevel node.
Supported child nodes
Node | Description |
---|---|
Product | Product configuration |
Example
<ServiceLevels>
<ServiceLevel>
<Products/>
</ServiceLevel>
</ServiceLevels>
Product
The Product node is used both on the SelectRule and the Products node.
1. Supported child nodes when placed under the Products node
Node | Description |
---|---|
Expressions | Change or apply data on fields |
GoodsTypeMapping | Logic to enable a GoodsType |
Services | Logic to enable service(s) |
ValidationRules | Custom validation |
PostCodeValidations | Custom PostCode validation |
CustomFields | Contain custom values to be returned for SA 2.0 |
Supports the following attributes
- name - name of the product
- conceptid - id of a concept carrier
- dbid - id of a custom product
- adviseprice - the name of the Price node
- rank - used together with the highestrank AllocationRule type
The following attributes are used together with the SS API method GetShipAdvise
0 - Disable the option (default) | 1 - Enable the option
- requireprice - no price calculated can be calculated for the product, the product will not be returned
- requiredroppoints - do not return the product if no droppoints is accessible.
Require the options "DropPoints":1 in the GetShipAdvise request
Example
<Products>
<Product>
<ProductGoodsType/>
<Services/>
<ValidationRules/>
<PostCodeValidations/>
<CustomFields/>
</Product>
</Products>
2. Supported child nodes when placed under a SelectRule node
Node | Description |
---|---|
Product | Product information |
Expressions | Apply custom data on field |
GoodsTypeMapping | Logic to enable a GoodsType |
Services | Logic to enable service(s) |
Supports the following attributes
- name - name of the product
- conceptid - id of a concept carrier
- dbid - id of a custom product
- adviseprice - the name of the Price node
Example
<SelectRule>
<Product>
<ProductGoodsType/>
<Services/>
</Product>
</SelectRule>
ProductGoodsType
Used to assign a good type to the selected product
The following attributes can be defined
- goodstypename - Not used, only for better readability in the file
- goodstypeid - the id coming from the carrier definition file.
- iscustom (0) - When using custom goods types, set this to 1.
Example
<SelectRule>
<Product>
<ProductGoodsType/>
</Product>
</SelectRule>
Services
The Services node contains a list of service(s) to be activated on the selected product.
Supported child nodes
Node | Description |
---|---|
Service | The Service to be activated on a product |
Service
The Service node is used to assign a service to a product.
The following attributes that can be defined
- name - the name of the service
- serviceid - Id of the service
Example
<CSR>
<SelectRules>
<SelectRule>
<Product>
<Services>
<Service/>
</Services>
</Product>
</SelectRule>
</SelectRules>
<ServiceLevels>
<ServiceLevel>
<SelectRules>
<SelectRule>
<SelectRule>
<Product>
<Services>
<Service/>
</Services>
</Product>
</SelectRule>
</SelectRule>
</SelectRules>
<Products>
<Product>
<Services>
<Service/>
</Services>
</Product>
</Products>
<AllocationRules>
<AllocationRule/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
PostCodeValidations
The PostCodeValidations node contains a list of PostCodeValidation node(s)
Note: See also the SelectRule implementation of PostCodeValidations
Supported child nodes
Node | Description |
---|---|
PostCodeValidation | The postcode(s) to run logic on |
PostCodeValidation
The PostCodeValidations node contains a list of service(s) to be activated on the selected product.
Note: See also the SelectRule implementation of PostCodeValidation
The following attributes that can be defined
- name - the name of the service
- serviceid - Id of the service
postcodevalidation - Range file - Type Numeric
<Product>
<PostcodeValidations>
<PostcodeValidation country="" exclude="1" type="numeric"
rangefile="file.txt"/>
</PostcodeValidations>
</Product>
// file.txt
6400,6500
7400,8000
postcodevalidation - Range file - Type UK
<Product>
<PostcodeValidations>
<PostcodeValidation country="GB" exclude="1" type="UK"
rangefile="file.txt"/>
</PostcodeValidations>
</Product>
// file.txt
NW9 0AA,
NW9 0AB,
NW9 0AC,
postcodevalidation - Inline - Type Numeric
<Product>
<PostcodeValidations>
<PostcodeValidation country="" exclude="1" type="numeric">
<Range min="6400" max="6500"/>
</PostcodeValidation>
</PostcodeValidations>
</Product>
postcodevalidation - Inline - Type UK
<Product>
<PostcodeValidations>
<PostcodeValidation country="GB" exclude="1" type="UK">
<Range min="BA" max=""/>
<Range min="BN1" max=""/>
</PostcodeValidation>
</PostcodeValidations>
</Product>
All postcodes starting with "BA" and "BN1" will be excluded.
ValidationRules
Can only be placed inside a Product node if the Product node is placed in a Products node
<CSR>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product>
<ValidationRules/>
</Product>
</Products>
</ServiceLevel>
</ServiceLevels>
</CSR>
ValidationRule
If the default carrier validations are not sufficient, you can add more validations on the Product with this node.
One or more can be added to a ValidationRules node
<Products>
<Product>
<ValidationRules>
<ValidationRule/>
</ValidationRules>
</Product>
</Products>
STRING_FIELDS
fld_LMarking, fld_LContents, fld_LGoodsType, fld_AdrName1, fld_AdrName2, fld_AdrAddress1, fld_AdrAddress2, fld_AdrPostNo, fld_AdrCity, fld_AdrCountry, fld_AdrState, fld_AdrPhone, fld_AdrMobile, fld_AdrEmail, fld_AdrAttention, fld_AdrReceiverRef, fld_AdrSenderCustNo, fld_AdrSenderName1, fld_AdrSenderName2, fld_AdrSenderAddress1, fld_AdrSenderAddress2, fld_AdrSenderPostNo, fld_AdrSenderCity, fld_AdrSenderCountry, fld_AdrSenderCountryName, fld_AdrSenderState, fld_AdrSenderPhone, fld_AdrSenderMobile, fld_AdrSenderEmail, fld_AdrSenderAttention, fld_RefOrderNumber, fld_RefProject, fld_MsgDriver, fld_MsgCarrier, fld_MsgReceiver, fld_CustomField1, fld_CustomField2, fld_CustomField3, fld_CustomField4, fld_CustomField5, fld_CustomField6, fld_CustomField7, fld_CustomField8, fld_CustomField9, fld_CustomField10
COUNTRY_FIELDS
fld_AdrCountry, fld_AdrSenderCountry, fld_AdrPayerCountry
FLOAT_FIELDS
fld_LWeight, fld_LLineWeight, fld_LHeight, fld_LLength, fld_LWidth, fld_LVolume, fld_LLineVolume, fld_LLoadmeter, fld_ShipmentVolumeMM3, fld_ShipmentWeightG, fld_ShipmentLoadmeter, fld_ShipmentMaxPackageLengthPlusCircumference
INT_FIELDS
fld_LNumber, fld_LRecycleNo, fld_DGNumber, fld_ShipmentCountPackages, fld_ShipmentCountLines
DATE_FIELDS
fld_RefDeliveryDate, fld_PickupDate, fld_RefPickupStart, fld_RefPickupEnd, fld_RefDeliveryStart, fld_RefDeliveryEnd
UNITS
mm3, dm3, m3 , g, kg , mm, cm, dm, m
This node can be configured in different ways:
stringcompare (Only if the field contain the value from the comparestring)
<ValidationRule name="stringcompare" comparestring="some_value"
equal="1" casesensitive="0" field="STRING_FIELDS"
custommessage=""/>
regex (Only if the field contain the value from the comparestring)
<ValidationRule name="stringcompare" type="regex" comparestring="a_regex_expression"
equal="1" casesensitive="0" field="STRING_FIELDS"
custommessage=""/>
country (Only NO, SE is allowed)
<ValidationRule name="country" allowcountries="NO,SE"
field="COUNTRY_FIELDS" custommessage=""/>
datelimits
<ValidationRule name="datelimits" min="dd.MM.YYYY" max="dd.MM.YYYY"
field="DATE_FIELDS" custommessage=""/>
datetimelimits
<ValidationRule name="datetimelimits"
min="dd.MM.YYYY hh:mm" max="dd.MM.YYYY hh:mm"
field="DATE_FIELDS" custommessage=""/>
timelimits
<ValidationRule name="timelimits" min="hh:mm" max="hh:mm"
field="DATE_FIELDS" custommessage=""/>
intlimits
<ValidationRule name="intlimits" min="0" max="1"
unit="UNITS" field="INT_FIELDS" custommessage=""/>
floatlimits
<ValidationRule name="floatlimits" min="0.0" max="10.5"
unit="UNITS" field="FLOAT_FIELDS" custommessage=""/>
Commands
Used to apply or change a setting on a Product
The following attributes that can be defined
- function - logic to perform
- name - target key
- value - value to apply
Example - SetOption
<Products>
<Product>
<Commands>
<Command function="SetOption" name ="Labels" value="PNG"/>
</Commands>
</Product>
</Products>
* used on the Shipment Server - SubmitShipment method to overwrite the requested label format
Example - PreAdviseOrder
<Products>
<Product>
<Commands>
<Command function="PreAdviseOrder" name="Submit" value="1"/>
</Commands>
</Product>
</Products>
* used on the Shipment Server - force PreAdviseOrder to submit the shipment instead of saving it to the Inbox
CustomFields
Use to define one or more static values that will be returned together with the product.
Note: This only works for the ShipmentServer method GetShipAdvise
Single
<CustomFields customer_carrier_code="PNParcel"/>
Multiple
<CustomFields key1="value" key2="value" key3="value" key4="value"/>
AllocationRules
The AllocationRules node contains one or more AllocationRule nodes.
The allocation is used to decide which, if more than one product is valid, should be used.
Supported child nodes
Node | Description |
---|---|
AllocationRule | Type of allocation |
Example
<CSR>
<ServiceLevels>
<ServiceLevel>
<AllocationRules>
<AllocationRule/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
AllocationRule
One or more can be placed under the AllocationRules node
Configurations
The Allocation rule can be configured to allocate product in different ways:
order - If all products are valid then the first product will be used e.g Product A
<CSR>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product name="Product A" conceptid="x"/>
<Product name="Product B" conceptid="y"/>
<Product name="Product C" conceptid="z"/>
</Products>
<AllocationRules>
<AllocationRule type="order"/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
preselected -If the selected product is valid then it will be used
<CSR>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product conceptid="x"/>
<Product conceptid="y"/>
</Products>
<AllocationRules>
<AllocationRule type="preselected"/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
lowestprice - Select the product with the lowest price
<CSR>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product conceptid="x"/>
<Product conceptid="y"/>
<Product conceptid="z"/>
</Products>
<AllocationRules>
<AllocationRule type="lowestprice"/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
highestrank - If multiple products is valid, the product with the highestrank will selected
<CSR>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product conceptid="x" rank="2"/>
<Product conceptid="y" rank="3"/>
<Product conceptid="z" rank="1"/>
</Products>
<AllocationRules>
<AllocationRule type="highestrank"/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
lowestprice and highestrank -
If multiple products is valid or if multiple products has the same price or the price is 0.
The AllocationRule highestrank will be used to select the product.
<CSR>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product name="Product C" dbid="x" rank="3"/>
<Product name="Product A" dbid="y" rank="2"/>
<Product name="Product B" dbid="z" rank="1"/>
</Products>
<AllocationRules>
<AllocationRule type="lowestprice"/>
<AllocationRule type="highestrank"/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
userselect -
An array of valid products will be returned, if only one product is valid a shipment will be created, to enforce an Array to always be return set the attribute onsingle to 1.
To also have the price returned, set the attribute price to 1
<CSR>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product name="Product C" dbid="x">
<Product name="Product A" dbid="y">
<Product name="Product B" dbid="z">
</Products>
<AllocationRules>
<AllocationRule type="userselect"
price="0" onsingle="0"/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
mincountforproduct -
Based on the scope a Product will be selected x times
The scope can be - Installation | location | Actor
On hosted solutions only use scope actor.
In the example below
Each day, Product C will first be selected 6 times exist based on the scope defined.
Then Product B will be used until 3 shipments exist in the database.
When both Product C and B mincountforproduct has been reached for the day, all Products may be selected.
<CSR>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product name="Product A" dbid="x"/>
<Product name="Product C" dbid="y"/>
<Product name="Product B" dbid="z"/>
</Products>
<AllocationRules>
<AllocationRule type="mincountforproduct" scope="actor"
name="Product C" dbid="y" mincount="6"/>
<AllocationRule type="mincountforproduct" scope="actor"
name="Product B" dbid="z" mincount="3"/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
distribution -
Use a mix of listed products for the scope specified.
The scope can be - Installation | location | Actor
On hosted solutions only use scope actor.
The share does not have to add up to 100. The way that the distribution works is that it removes the product that is not valid then calculates the share each remaining product should have and selects the one that has the biggest difference between the intended share and the actual share.
In the example below, since both products share the same validation, both products will be used evenly.
<CSR>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product name="Product A" dbid="x"/>
<Product name="Product B" dbid="y"/>
</Products>
<AllocationRules>
<AllocationRule type="distribution" scope="actor">
<Product name="Product B" dbid="x" share="50"/>
<Product name="Product A" dbid="y" share="50"/>
</AllocationRule>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
NOTE: distribution currently does not work when configured using the Shipping Rules user interface.
Condition
To control an AllocationRule, Expression, ValidationRule, or the CSR node a Condition node can be applied.
If you add more than one Condition node, all have to be valid in order for the parent node to be valid.
Example - only assign the value 1000 if the imported value is less or equal to 999
<Expressions>
<Expression targetfield="fld_LWeight">
<Condition name="floatlimits" field="fld_LWeight"
min="0" max="999" unit="gram"/>
<Item expression="1000"/>
</Expression>
</Expressions>
The Condition node supports different validations
stringcompare
<Condition name="stringcompare" field="fld_CustomField1"
comparestring="a_value" equal="1" casesensitive="0"/>
receivercontries
<Condition name="receivercontries" countries="SE,NO" exclude="1"/>
stringnotempty
<Condition name="stringnotempty" field="fld_RefOrderNumber"/>
floatlimits
<Condition name="floatlimits" min="0.0" max="10.5"
unit="UNITS" field="FLOAT_FIELDS" custommessage=""/>
Supported nodes
<CSR>
<ErrorOn/>
<Condition/>
<SelectRules>
<SelectRule>
<Expressions>
<Expression>
<Condition/>
<Item/>
</Expression>
</Expressions>
<Product/>
</SelectRule>
</SelectRules>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product>
<ValidationRules>
<ValidationRule>
<Condition/>
</ValidationRule>
</ValidationRules>
</Product>
</Products>
<AllocationRules>
<AllocationRule>
<Condition/>
</AllocationRule>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>
Expressions
It can be placed under CSR, ServiceLevel, SelectRule & Product nodes.
Supported child nodes
Node | Description |
---|---|
Expressions | Type of allocation |
Supports the following attributes (1 = true, 0 = false)
- prevalidation - execute before validation
- assignresult - assign result to the shipment
Default settings for the attributes if not specified
<CSR>
<Expressions prevalidation="0" assignresult="0"/>
<SelectRules>
<Expressions/>
<SelectRule>
<Product>
<Expressions/>
</Product>
</SelectRule>
</SelectRules>
<ServiceLevels>
<ServiceLevel>
<Expressions/>
<Products>
<Product>
<Expressions/>
</Product>
</Products>
</ServiceLevel>
</ServiceLevels>
</CSR>
Expression
With this node, you can assign value to a field.
It can only be placed inside the Expressions node.
Supported child nodes
Node | Description |
---|---|
Condition | Validation |
Item | Value to assign |
Supports the following attributes (1 = true, 0 = false)
- targetfield - the field to assign the value to
FIELD
fld_LMarking, fld_LContents, fld_LGoodsType, fld_AdrName1, fld_AdrName2, fld_AdrAddress1, fld_AdrAddress2, fld_AdrPostNo, fld_AdrCity, fld_AdrCountry, fld_AdrState, fld_AdrPhone, fld_AdrMobile, fld_AdrEmail, fld_AdrAttention, fld_AdrReceiverRef, fld_AdrSenderCustNo, fld_AdrSenderName1, fld_AdrSenderName2, fld_AdrSenderAddress1, fld_AdrSenderAddress2, fld_AdrSenderPostNo, fld_AdrSenderCity, fld_AdrSenderCountry, fld_AdrSenderCountryName, fld_AdrSenderState, fld_AdrSenderPhone, fld_AdrSenderMobile, fld_AdrSenderEmail, fld_AdrSenderAttention, fld_RefOrderNumber, fld_RefProject, fld_MsgDriver, fld_MsgCarrier, fld_MsgReceiver, fld_CustomField1, fld_CustomField2, fld_CustomField3, fld_CustomField4, fld_CustomField5, fld_CustomField6, fld_CustomField7, fld_CustomField8, fld_CustomField9, fld_CustomField10
In the sample below the targetfield will get the value custom_value
<Expressions>
<Expression targetfield="FIELD">
<Item expression="custom_value"/>
</Expression>
</Expressions>
The Expression node can have one or more Item nodes
<Expressions>
<Expression>
<Item expression="custom"/>
<Item expression="_"/>
<Item expression="value"/>
</Expression>
</Expressions>
In this case, the targetfield will get the value custom_value
The Item expression can also use a value from another field using the @@
<Expressions>
<Expression targetfield="FIELD">
<Item expression="@@FIELD@@"/>
</Expression>
</Expressions>
GoodsTypeMappings
With this node, you can assign GoodsType on a product. Using an imported value or the entry product.
It can only be placed under the CSR node
Attributes - (1 = true, 0 = false)
- mappingfield
- mappingoverride - (0) - Use GoodsType from GoodsTypesMappings and not from the Product node
- key - value from the attribute mappingfield on the GoodsTypesMappings
- productconceptid - Since goods type IDs are only unique within a carrier, you need to specify the concept ID of the product. When using this for custom product and custom goods types, set it to 0.
- goodstypename - Not used, only for better readability in the file
- goodstypeid - Is the id coming from the carrier definition file.
- iscustom (0) - When using custom goods types, set this to 1.
Configurations
It can be configured in two ways
- Groups by entry product
CSR will check if the selected product has a goods type within the same group as the product it was changed from. Then it will use this goods type on the shipment before submitting. - Groups by value from a field
CSR will see if the value from the field configured on the mapping attribute exist on a group and use the defined goods type on the shipment before submitting
Groups by entry product
<CSR>
<GoodsTypeMappings>
<GoodsTypeMapping>
<ProductGoodsType goodstypeid="2" dbid="2139" iscustom="1"
goodstypename="2"/>
<ProductGoodsType goodstypeid="3" productconceptid="112"
goodstypename="PL4"/>
</GoodsTypeMapping>
<GoodsTypeMapping>
<ProductGoodsType goodstypeid="1" dbid="2139" iscustom="1"
goodstypename="1"/>
<ProductGoodsType goodstypeid="13" productconceptid="112"
goodstypename="K25"/>
</GoodsTypeMapping>
</GoodsTypeMappings>
<ServiceLevels>
<ServiceLevel name="default">
<Products>
<Product name="Product A" dbid="2139"/>
<Product name="Product B" conceptid="112"/>
</Products>
</ServiceLevel>
</ServiceLevels>
</CSR>
Groups by value from a field
<CSR>
<GoodsTypeMappings mappingfield="fld_LMarking">
<GoodsTypeMapping key="parcel">
<ProductGoodsType goodstypeid="1" productconceptid="113"
goodstypename="P"/>
<ProductGoodsType goodstypeid="13" productconceptid="112"
goodstypename="K25"/>
</GoodsTypeMapping>
<GoodsTypeMapping key="pallet">
<ProductGoodsType goodstypeid="0" productconceptid="113"
goodstypename="A"/>
<ProductGoodsType goodstypeid="3" productconceptid="112"
goodstypename="PL4"/>
</GoodsTypeMapping>
</GoodsTypeMappings>
<ServiceLevels>
<ServiceLevel name="default">
<Products>
<Product name="PRODUCT A" conceptid="113"/>
<Product name="PRODUCT B" conceptid="112"/>
</Products>
</ServiceLevel>
</ServiceLevels>
</CSR>
ServiceMappings
With this node, you can assign Service(s) on a product. Using an imported value or the entry product.
It can only be placed under the CSR node.
Attributes
- mappingfield - this field must be a shipment field.
- key - value from the attribute mappingfield on the ServiceMappings
- name - name of the service
- serviceid - Id of the service
Configurations
It can be configured in two ways
- Service by selected product
In this mode, you configure groups, and when a service is within a group on the original product – CSR will see if the selected product has a service within the same group and set that service on the shipment before submitting. - Service by value from a field
With this mode, you also configure groups, but you use keys to find the group rather than the originally selected services.
Service by selected product
<CSR>
<ServiceMappings>
<ServiceMapping>
<Service serviceid="y"/>
<Service serviceid="x"/>
</ServiceMapping>
<ServiceMapping>
<Service serviceid="x"/>
<Service serviceid="y"/>
</ServiceMapping>
</ServiceMappings>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product name="Product A" dbid="x"/>
<Product name="Product A" dbid="y"/>
</Products>
</ServiceLevel>
</ServiceLevels>
</CSR>
Service by value from a field
<CSR>
<ServiceMappings mappingfield="fld_CustomField1">
<ServiceMapping key="notification">
<Service serviceid="y"/>
<Service serviceid="x"/>
</ServiceMapping>
</ServiceMappings>
<ServiceLevels>
<ServiceLevel>
<Products>
<Product name="Product A" dbid="x"/>
<Product name="Product A" dbid="y"/>
</Products>
</ServiceLevel>
</ServiceLevels>
</CSR>
Prices
It can only be placed once under the CSR node.
This node enables you to have a simple price calculation in your CSR.
Supported child nodes
Node | Description |
---|---|
Price | Price Calculation node |
Price
Contain one price calculation.
Supported child nodes
Node | Description |
---|---|
Exceptions | Fixed price base on a condition |
Ranges | Price based on Interval |
Fees | A value to be added to either the Exception or Range |
Supports the following attributes
name - The id of the node, used by the attribute adviseprice on the Product node
currency - E.g EUR, SEK, NOK
Example
<CSR>
<Prices>
<Price name="" currency="">
<Exceptions>
<Exception price="">
<ValidationRules/>
</Exception>
</Exceptions>
<Ranges field="fld_AdrPostNo">
<Range from="" to="" price="">
<Ranges field="fld_ShipmentWeightG" unit="gram">
<Range from="" to="" price=""/>
</Ranges>
</Range>
<Range from="" to="" price=""/>
</Ranges>
<Fees>
<Fee price="">
<ValidationRules/>
</Fee>
</Fees>
</Price>
</Prices>
</CSR>
Exceptions
It can only be placed once under the Price node
Contain one or more Exception nodes
Supported child nodes
Node | Description |
---|---|
Exception | Return a fixed price |
Exception
The first Exception node where all the Validations are valid will return the price
Supported child nodes
Node | Description |
---|---|
ValidationRules | See the ValidationRule node |
Supports the following attributes
- price - The value to be returned on the product
Ranges
This is evaluated after the Exceptions node, if there is a matching Exception node then the Ranges node will not be executed.
Supported child nodes
Node | Description |
---|---|
Ranges | Support another Ranges node |
Range | Contain the price for the range |
Supports the following attributes
- field - the field to run the range logic on fld_ShipmentWeightG | fld_AdrPostNo
- unit - used with the field fld_ShipmentWeightG
Range
This is evaluated after the Exceptions node, if there is a matching Exception node then the Ranges node will not be executed.
Supported child nodes
Node | Description |
---|---|
Range | Contain the price for the range |
Supports the following attributes
- from - start value
- to - end value
- price - the price to return
Fees
This works similarly to Exceptions, it is a list of Fees, and each has validation rules that need to be valid, for the fee to be applied. The prices on all Fee nodes that are valid will be added together. And the sum here will be added to the sum found on Exceptions or Ranges
Supported child nodes
Node | Description |
---|---|
Fee | A fee to be added to the price |
Fee
If all ValidationRules are valid the fee will be added to the Price from the Exceptions or Ranges node
Supported child nodes
Node | Description |
---|---|
ValidationRules | See the ValidationRules node |
Supports the following attributes
- price - the value to be added on the price from either the range or exception node
-
Expressions - Example 1
Add a default pickup start and end datetime
<Expressions prevalidation="1" assignresult="1">
<Expression targetfield="fld_RefPickupStart">
<Item special="datenow" addhours="0" format="YYYY-MM-DD 05:00:00" />
</Expression>
<Expression targetfield="fld_RefPickupEnd">
<Item special="datenow" addhours="0" format="YYYYY-MM-DD 21:00:00" />
</Expression>
</Expressions>
-
AllocationRules UserSelect - Example 1
Only execute Shipping Rules when using Product 1782 or 1783
<CSR defaultservicelevel="default" nocache="1" showservicelevelsinpv="1">
<Expressions prevalidation="1" assignresult="0">
<Expression targetfield="fld_CustomField1">
<Item expression="C-"/>
<Item expression="@@fld_ProductConceptID@@"/>
</Expression>
</Expressions>
<Condition name="stringcompare" type="regex" comparestring="^(C-1782|C-1783)" equal="1"
casesensitive="0" field="fld_CustomField1" />
<ServiceLevels>
<ServiceLevel name="default">
<Products>
<Product name="Generic Sweden - Generic 1" conceptid="1782">
<ProductGoodsType name="EUR 1 - 08 m × 12 m" goodstypeid="0"/>
<Services>
<Service name="0 - Service1" serviceid="227030" />
<Service name="2 - 013 (CIP)" serviceid="227013" />
</Services>
</Product>
<Product name="Generic Sweden - Generic 2" conceptid="1783" />
</Products>
<AllocationRules>
<AllocationRule type="userselect" price="1" onsingle="1"/>
</AllocationRules>
</ServiceLevel>
</ServiceLevels>
</CSR>