This is a reference for all functions available in vendor_actions and suredone_actions. Both configurations use the same functions and the same structure. The only difference is which object they operate on:
vendor_actions-- functions apply to the current vendor item (from the external file/API).suredone_actions-- functions apply to the current SureDone item (from the database).
All fields used in actions must be mapped in either field_map or field_run, and must use their SureDone-mapped names (the left side of the mapping).
General Structure
Each action configuration is an object in an array. The optional search key filters which items the functions apply to. When search is omitted, the functions apply to every item.
"vendor_actions": [
{
"search": "field:=value",
"functionName": "arguments"
}
]
Functions execute in the order they are defined, top to bottom.
Data Manipulation Functions
setValue
Set one or more fields to constant values.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are field names, values are the values to set |
| Applies to | Products, Orders |
{
"search": "vendorstock:=\"Out of Stock\"",
"setValue": {
"stock": 0,
"condition": "Used"
}
}
Sets stock to 0 and condition to "Used" for items where vendorstock equals "Out of Stock".
ignoreValue / ignoreField
Ignore the vendor value for a field and keep the current SureDone value instead. ignoreField and ignoreValue are aliases for the same function.
| Property | Detail |
|---|---|
| Arguments | String -- the field name to ignore |
| Applies to | Products, Orders |
{
"search": "invoverride:=1",
"ignoreValue": "stock"
}
When invoverride is 1 in the SureDone item, the stock value from the vendor file is discarded and the existing SureDone value is kept.
remapField
Overwrite the value of one field with the value from another field.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are target fields, values are source fields to copy from |
| Applies to | Products, Orders |
{
"search": "mapoverride:=1",
"remapField": {
"price": "mrp"
}
}
When mapoverride is 1, the value of price is replaced with the value from mrp. The source field (mrp) must be mapped in field_map or field_run.
replace
Perform string find-and-replace on a field value.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are target fields, values are objects of {"search": "replacement"} pairs |
| Applies to | Products, Orders |
{
"replace": {
"title": {
"'": "",
"&": "&"
}
}
}
Strips single quotes and replaces & with & in the title field.
regexExtract
Extract a substring from a field using a regular expression.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are target fields, values are objects with regex (required) and capture_group (optional, defaults to last group) |
| Applies to | Products, Orders |
{
"regexExtract": {
"warehouselocation": {
"regex": "/(.*)Location: (.*)\\[/",
"capture_group": 2
}
}
}
From a value like "Warehouse : MUF Location: 1I-6[WPS101] Quantity: 3", extracts "1I-6" (the second capture group).
combine
Concatenate multiple fields into a single field, or implode an array field into a string.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are target fields, values are objects with fields (array), delimiter (string, default "-"), and ignore_empty (boolean, default false) |
| Applies to | Products, Orders |
Combining multiple fields:
{
"combine": {
"guid": {
"fields": ["brand", "mpn"],
"delimiter": "-"
}
}
}
If brand is "Acme" and mpn is "12345", guid becomes "Acme-12345".
Imploding an array field:
{
"combine": {
"acesvehicleid": {
"fields": ["acesvehicleid"],
"delimiter": "*"
}
}
}
If acesvehicleid is [1, 2, 3], the result is "123".
convertDateTime
Convert a date/time value to a specified format. Uses UTC. Accepts Unix timestamps and parseable date strings.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are target fields, values are PHP date format strings |
| Applies to | Products, Orders |
{
"convertDateTime": {
"dateutc": "Y-m-d\\TH:i:s\\Z"
}
}
Converts the value of dateutc to ISO 8601 format (e.g., "2024-03-15T14:30:00Z").
Math Functions
All math functions accept the same argument structure: an object where keys are target fields and values are arrays of field names and/or literal numeric values. Operations are applied left to right across the array.
sum
Add values together.
| Property | Detail |
|---|---|
| Arguments | Object -- {"targetField": ["field1", "field2", 10]} |
| Applies to | Products, Orders |
{
"sum": {
"total": ["subtotal", "shipping", "tax"]
}
}
Sets total = subtotal + shipping + tax.
subtract
Subtract values sequentially (left to right).
| Property | Detail |
|---|---|
| Arguments | Object -- {"targetField": ["field1", "field2"]} |
| Applies to | Products, Orders |
{
"subtract": {
"profit": ["price", "cost", "fee"]
}
}
Sets profit = price - cost - fee.
multiply
Multiply values together.
| Property | Detail |
|---|---|
| Arguments | Object -- {"targetField": ["field1", 1.15]} |
| Applies to | Products, Orders |
{
"multiply": {
"price": ["cost", 1.15]
}
}
Sets price = cost * 1.15 (a 15% markup).
divide
Divide values sequentially (left to right). Division by zero is silently skipped.
| Property | Detail |
|---|---|
| Arguments | Object -- {"targetField": ["field1", "field2"]} |
| Applies to | Products, Orders |
{
"divide": {
"unitprice": ["totalprice", "quantity"]
}
}
Sets unitprice = totalprice / quantity.
min
Set a field to the minimum value from a list of fields and/or constants.
| Property | Detail |
|---|---|
| Arguments | Object -- {"targetField": ["field1", "field2", 100]} |
| Applies to | Products, Orders |
{
"min": {
"bestprice": ["price1", "price2", "price3"]
}
}
Sets bestprice to the smallest value among price1, price2, and price3.
max
Set a field to the maximum value from a list of fields and/or constants.
| Property | Detail |
|---|---|
| Arguments | Object -- {"targetField": ["field1", "field2", 0]} |
| Applies to | Products, Orders |
{
"max": {
"stock": ["stock", 0]
}
}
Ensures stock is never negative by taking the greater of the current value and 0.
Rounding Functions
round
Round a field value to a specified decimal precision using standard rounding.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are field names, values are the number of decimal places |
| Applies to | Products, Orders |
{
"round": {
"price": 2
}
}
Rounds price to 2 decimal places (e.g., 9.876 becomes 9.88).
roundUp
Round up to the nearest whole number, optionally adjusting by a decimal ending.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are field names, values are the decimal ending (use 0 for plain ceiling) |
| Applies to | Products, Orders |
{
"roundUp": {
"price": 0.95
}
}
A value of 14.20 rounds up to 14.95. A value of 14.96 rounds up to 15.95 (because the decimal exceeds 0.95).
roundDown
Round down to the nearest whole number, optionally adjusting by a decimal ending.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are field names, values are the decimal ending (use 0 for plain floor) |
| Applies to | Products, Orders |
{
"roundDown": {
"price": 0.99
}
}
A value of 15.50 rounds down to 15.99. A value of 15.98 (below 0.99) rounds down to 14.99.
roundNearest
Round to the nearest value on a repeating interval with a fixed ending.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are field names, values are objects with base (interval step) and ending (offset) |
| Applies to | Products, Orders |
{
"roundNearest": {
"price": {
"base": 10,
"ending": 9.95
}
}
}
Rounds to the nearest x9.95 value. A value of 23.00 rounds to 19.95. A value of 27.00 rounds to 29.95. The rounding points are 9.95, 19.95, 29.95, 39.95, etc.
Auto-Increment
autoIncrement
Generate a sequential number for each processed item. Useful for line numbers or sequence IDs.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are field names, values are objects with start (default 1) and step (default 1) |
| Applies to | Products, Orders |
{
"autoIncrement": {
"line1": {"start": 3, "step": 2},
"line2": {},
"line3": {"step": -1}
}
}
For successive items: line1 = 3, 5, 7, 9... / line2 = 1, 2, 3, 4... / line3 = 1, 0, -1, -2...
Text Case Functions
uppercase
Convert a field value to all uppercase characters.
| Property | Detail |
|---|---|
| Arguments | String (single field) or Object (multiple fields) |
| Applies to | Products, Orders |
{
"uppercase": "brand"
}
Converts "acme" to "ACME".
For multiple fields, use an object:
{
"uppercase": {
"brand": "",
"mpn": ""
}
}
lowercase
Convert a field value to all lowercase characters.
| Property | Detail |
|---|---|
| Arguments | String (single field) or Object (multiple fields) |
| Applies to | Products, Orders |
{
"lowercase": "title"
}
Converts "WIDGET BLUE" to "widget blue".
Encoding Functions
jsonEncode
JSON-encode the value of a field. Useful when a field contains an array or object that needs to be serialized to a string.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are field names, values are empty strings |
| Applies to | Products, Orders |
{
"jsonEncode": {
"customdata": ""
}
}
If customdata is ["a", "b"], the result is "[\"a\",\"b\"]".
base64Encode
Base64-encode the value of a field.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are field names, values are empty strings |
| Applies to | Products, Orders |
{
"base64Encode": {
"payload": ""
}
}
Encodes the value of payload as a Base64 string.
base64Decode
Base64-decode the value of a field. If decoding fails, the original value is preserved.
| Property | Detail |
|---|---|
| Arguments | Object -- keys are field names, values are empty strings |
| Applies to | Products, Orders |
{
"base64Decode": {
"payload": ""
}
}
Decodes the Base64 value of payload back to its original string.
Item Lifecycle Functions
ignoreItem / ignoreObject
Skip the current item entirely -- it will not be included in the resulting bulk file. ignoreItem and ignoreObject are aliases.
| Property | Detail |
|---|---|
| Arguments | Void -- pass an empty string |
| Applies to | Products, Orders |
{
"search": "(status:=disable status:=draft)",
"ignoreItem": ""
}
Skips any item with a status of "disable" or "draft". Also works with missing_vendor_items to prevent specific items from being deleted/ended.
deleteItem
Set the item's action to delete in the resulting bulk file and remove it from normal processing.
| Property | Detail |
|---|---|
| Arguments | Void -- no arguments needed |
| Applies to | Products |
{
"search": "discontinued:=1",
"deleteItem": ""
}
Deletes any item where discontinued is 1.
endItem
Set the item's action to end in the resulting bulk file and remove it from normal processing. Ending a product deactivates the listing without deleting it.
| Property | Detail |
|---|---|
| Arguments | Void -- no arguments needed |
| Applies to | Products |
{
"search": "stock:=0",
"endItem": ""
}
Ends the listing for any item with zero stock.
ignoreOrder
Skip an entire order when a search condition matches on any of its line items. Unlike ignoreItem, which skips a single item, ignoreOrder prevents the entire order from processing.
| Property | Detail |
|---|---|
| Arguments | Void -- no arguments needed |
| Applies to | Orders |
{
"search": "supplier:=\"Do Not Export\"",
"ignoreOrder": ""
}
Skips the entire order if any of its items has supplier set to "Do Not Export".
Address Function
setAddress
Change the destination address for the current object's export. Only valid when payload_multi is false and a template is set, because each object is sent individually in that mode. Works with connection types that support address (e.g., email, HTTP).
| Property | Detail |
|---|---|
| Arguments | String -- the new address. Use "email" to pull the address from the item's email field. |
| Applies to | Products, Orders |
{
"search": "supplier:=\"Shane's Supplies\"",
"setAddress": "shane@example.com"
}
Sends the export to a different email address based on the supplier. Can also use the special value "email" to dynamically set the address from the order's email field.
Status Action Functions
These functions are used within status_actions (not vendor_actions or suredone_actions). They are triggered by the value of a status field as defined in field_map_status.
zeroStock
Set the target field's stock value to zero.
| Property | Detail |
|---|---|
| Arguments | Void -- pass an empty string |
| Used in | status_actions |
"status_actions": {
"Discontinued": {
"zeroStock": ""
}
}
When the status field contains "Discontinued", the corresponding stock field is set to 0.
setStock
Set the target field's stock value to a specific number.
| Property | Detail |
|---|---|
| Arguments | Number -- the stock value to set |
| Used in | status_actions |
"status_actions": {
"In Stock": {
"setStock": 999
}
}
When the status field contains "In Stock", the corresponding stock field is set to 999.
assignStatus
Save the status value to a specified SureDone field.
| Property | Detail |
|---|---|
| Arguments | String -- the field name to save the status value to |
| Used in | status_actions |
"status_actions": {
"Active": {
"assignStatus": "vendorstatus"
},
"Discontinued": {
"assignStatus": "vendorstatus",
"zeroStock": ""
}
}
Saves the status text ("Active" or "Discontinued") to the vendorstatus field. Multiple functions can be combined in a single status entry.
Quick Reference Table
| Function | Arguments | Category | Description |
|---|---|---|---|
setValue |
{"field": "value"} |
Data | Set field(s) to constant values |
ignoreValue |
"field" |
Data | Keep SureDone value, ignore vendor value |
ignoreField |
"field" |
Data | Alias for ignoreValue |
remapField |
{"target": "source"} |
Data | Copy value from another field |
replace |
{"field": {"find": "replace"}} |
Data | String find-and-replace |
regexExtract |
{"field": {"regex": "...", "capture_group": N}} |
Data | Extract substring via regex |
combine |
{"field": {"fields": [...], "delimiter": "-"}} |
Data | Concatenate fields |
convertDateTime |
{"field": "Y-m-d"} |
Data | Reformat date/time values |
sum |
{"target": ["a", "b", 10]} |
Math | Add values |
subtract |
{"target": ["a", "b"]} |
Math | Subtract values left to right |
multiply |
{"target": ["a", 1.15]} |
Math | Multiply values |
divide |
{"target": ["a", "b"]} |
Math | Divide values left to right |
min |
{"target": ["a", "b", "c"]} |
Math | Minimum of values |
max |
{"target": ["a", "b", 0]} |
Math | Maximum of values |
round |
{"field": 2} |
Rounding | Round to N decimal places |
roundUp |
{"field": 0.95} |
Rounding | Round up with optional decimal ending |
roundDown |
{"field": 0.99} |
Rounding | Round down with optional decimal ending |
roundNearest |
{"field": {"base": 10, "ending": 9.95}} |
Rounding | Round to nearest interval + offset |
autoIncrement |
{"field": {"start": 1, "step": 1}} |
Sequence | Generate sequential numbers |
uppercase |
"field" or {"field": ""} |
Text | Convert to uppercase |
lowercase |
"field" or {"field": ""} |
Text | Convert to lowercase |
jsonEncode |
{"field": ""} |
Encoding | JSON-encode field value |
base64Encode |
{"field": ""} |
Encoding | Base64-encode field value |
base64Decode |
{"field": ""} |
Encoding | Base64-decode field value |
ignoreItem |
"" |
Lifecycle | Skip item from bulk file |
ignoreObject |
"" |
Lifecycle | Alias for ignoreItem |
deleteItem |
"" |
Lifecycle | Set item action to "delete" |
endItem |
"" |
Lifecycle | Set item action to "end" |
ignoreOrder |
"" |
Lifecycle | Skip entire order |
setAddress |
"address" |
Export | Change export destination address |
zeroStock |
"" |
Status | Set stock to 0 (status_actions only) |
setStock |
999 |
Status | Set stock to value (status_actions only) |
assignStatus |
"field" |
Status | Save status to field (status_actions only) |