Challenge:
The requirement was to define a key/value pair in Pimberly upon product creation. This key/value data was essential for passing information to a connector before integration with our ERP system. Currently, Pimberly does not support defining key/value pairs directly via rules or workflows.
0
Comments
Please sign in to leave a comment.
Solution:
A dedicated channel and corresponding feed were created to address this gap. The channel outputs two fields as expressions, both derived via dataset lookups based on another attribute, resulting in comma-separated lists of equal length to ensure a reliable 1:1 relationship for the key/value pairs. This channel exports data rapidly to ensure its availability before another, slower channel exports the product data.
The exported comma-separated values (CSV) file is consumed by a feed running at a similar high frequency, mapping one column as keys and the other as corresponding values. To handle scenarios requiring null values, exporting data with a trailing comma (e.g., "value",) correctly translated to a null value in the downstream API.
Dataset Example
Channel Example
Feed Example
Update:
The existing solution needed expansion to accommodate additional data, but the original method was not scalable enough. Working collaboratively with the team managing the intermediate system, an alternative approach was devised using a stringified JSON dictionary.
This format was viable because the key/value pairs required are deterministic, based on a new attribute value. Although the Pimberly channel escapes double quotes in the output, this can be managed effectively if the intermediate system correctly parses the escaped stringified JSON.
This solution also no longer requires a defined Key/Value pair attribute, moreover, as it too is a dataset lookup, it also doesn’t need a dedicated attribute. Less attributes, less to govern ;)
Dataset Example
API Example