When a new order is created, you often need to break it down into actionable subitems in Monday.com. This process takes the products from an order, matches them against your service code database, and prepares the data to generate the necessary subitems automatically.
By matching order data with predefined service codes, you ensure that every subitem has the correct title, assigned team members, and QuickBooks tracking information.
flowchart LR
A[Order Products] --> C{Data Parser}
B[Service Code DB] --> C
C --> D[Extract Quantity]
C --> E[Identify Bundles]
C --> F[Format Titles]
D & E & F --> G[Monday.com Subitems]How the parsing works
The script processes incoming order data and cross-references it with your database. Here is how it handles specific product details:
- 1
Match against the database
Every product in the order is checked against the Service Code Database using its
productId. If a match is found, the script pulls in default settings like QuickBooks categories, default team members, and time calculation codes. - 2
Extract quantities
The script looks at the first character of the
productName. If it starts with a number between 2 and 9 (e.g., "3x Consultation"), it automatically sets the quantity. If no number is found, the quantity defaults to1. - 3
Identify bundles
Products are evaluated to see if they belong to a bundle. The script assigns a status of
Bundle(if it is the parent bundle product),Yes(if it is a member of a bundle), orNo(if it is a standalone product). - 4
Format subitem titles
For matched products, the script combines the
titleCodeandtitleOrderfrom the database (e.g.,CODE-01) to create a standardizedtitleParsingstring for the Monday.com subitem.
Database Mapping Reference
When a product ID matches a record in your database, the following fields are mapped to the new subitem:
| Database Field | Description | Subitem Usage |
|---|---|---|
| Title Code & Order | Standardized naming prefix and sequence. | Used to build the subitem's name. |
| QBO ID & Category | QuickBooks Online identifiers. | Syncs the subitem to your accounting software. |
| Default Member | The Monday.com user ID of the assignee. | Automatically assigns the subitem to a team member. |
| Time Calc Code | Rules for calculating estimated time. | Sets the time tracking or timeline columns. |
If a product in the order is not found in the database, the script will still process it but will label the missing database fields as (no match).
Testing with Dry Run
Before creating real subitems in Monday.com, you can test your parsing logic using the built-in Dry Run feature.
Setting DRY_RUN = true allows you to view the exact output shape and parsing results in your automation logs without actually firing the Monday.com API mutation.
// Flip this to false when you're ready to actually create subitems.
// Output shape is identical either way — only whether the Monday
// API call fires changes.
const DRY_RUN = true;
const MONDAY_API_TOKEN = inputData.apiToken;Example Parsing Script
Here is a simplified version of the JavaScript used in the automation step to parse the items. You can use this in your Zapier or Make.com code steps.
const split = (s) => (s ? String(s).split(",").map((x) => x.trim()).filter(Boolean) : []);
const stripHtml = (s) => (s || "").replace(/<[^>]*>/g, "").trim();
// 1. Gather order inputs
const orderProductIds = split(inputData.orderProductIds);
const orderProductNames = split(inputData.orderProductNames).map(stripHtml);
const bundleIdForSearch = (inputData.bundleId || "").trim() || "0";
const bundleMembers = new Set(split(inputData.bundleMembers));
// 2. Build the database map (simplified)
const itemsDB = {};
split(inputData.dbProductIds).forEach((id, i) => {
itemsDB[id] = {
titleCode: split(inputData.dbTitleCodes)[i] || "",
titleOrder: split(inputData.dbTitleOrders)[i] || "",
qboId: split(inputData.dbQboIds)[i] || ""
};
});
// 3. Parse and prepare subitems
const preview = [];
orderProductIds.forEach((productId, i) => {
const productName = orderProductNames[i] || "";
const dbItem = itemsDB[productId] || null;
// Extract quantity from the first character
const firstChar = productName.charAt(0);
const quantity = /^[2-9]$/.test(firstChar) ? firstChar : "1";
// Determine bundle status
let score = 0;
if (bundleIdForSearch === productId) score = 1;
else if (bundleIdForSearch !== "0" && bundleMembers.has(productId)) score = 2;
const isInBundle = score === 1 ? "Bundle" : score === 2 ? "Yes" : "No";
// Format title
const titleParsing = dbItem && dbItem.titleCode && dbItem.titleOrder
? `${dbItem.titleCode}-${dbItem.titleOrder}`
: "(none)";
preview.push({
productId,
productName,
quantity,
isInBundle,
titleParsing,
foundInServiceCodeTable: !!dbItem
});
});
// The 'preview' array is now ready to be sent to the Monday.com GraphQL API