Set opportunity products
set_opportunity_productsSet the products on an opportunity so its VALUE derives from them (replace-all). You pick a SELECTION of catalog products + a count for each; the SERVER prices it — it snapshots each product's price from the catalog, computes every line total, and writes the total into the opportunity's value (amount). You never pass a price. The list you pass becomes the WHOLE product set on the opportunity (the previous lines are replaced); pass an empty list to clear the products (the value follows to zero — no products, no value). Catalog products live on the product object: each prices from its unit_price_cents (an INTEGER number of cents) and its pricing_mode — per_unit multiplies by the count, flat charges once regardless of count (a flat line with count > 1 is flagged so a mispriced catalog is never silent). Discounts are by PERCENT only (a per-line discount_pct, and/or a top-level discount_pct for the whole opportunity) — the server computes the discount cents; you never pass a money amount. Bundled items are expanded automatically. A count outside a product's tier is flagged (not blocked). A discontinued catalog item can still be priced on an existing agreement by passing include_discontinued:true on its line (a boolean, not a price). Available once the 'opportunity_products' template is applied. Returns the opportunity's fresh state, its priced lines, and any flags.
When to use: When an opportunity's value should come from the products on it (available once the 'opportunity_products' template is applied). You pick the catalog items and how many of each; the server prices them and writes the total into the opportunity's value — you never pass a price. The list you pass replaces the whole product set; pass an empty list to clear it (the value follows to zero).
Example: Put 15 units of the standard plan on the Acme opportunity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | Yes | The WHOLE product set (replace-all): [{product_id: product uuid, quantity: integer ≥ 0, discount_pct?: 0–100, include_discontinued?: boolean}]; [] clears every line. | |
| discount_pct | No | A number from 0 to 100. | |
| opportunity_id | Yes | A uuid. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| updated | No | ||
| guidance | No | ||
| line_items | No | ||
| opportunity | No | ||
| missing_objects | No | ||
| tier_validations | No | ||
| pricing_mode_validations | No |