Nue Apex Global Methods for Quotes and Orders
22 min
nue on salesforce exposes a set of apex global methods that let you programmatically create quotes and orders — with the same pricing fidelity as the nue ui these methods fall into two categories that map to two distinct business motions create quote / create order — for new business initial quotes and orders that add net new products and subscriptions to a customer account create change quote / create change order — for lifecycle changes quotes and orders that modify existing subscriptions, assets, and entitlements — renewals, quantity adjustments, price changes, cancellations, upgrades, and cross sells both categories are semantic, use case driven apis you describe what you want — products, quantities, terms, change types — and the nue pricing engine handles everything else product resolution, bundle expansion, pricing calculations, discount propagation, tax, and validation ai coding skill this guide includes a companion ai skill file designed for ai coding assistants such as claude code, cursor, copilot, openai codex, chatgpt, or any llm based development tool the skill encodes the core behavior rules of the create quote and create order apis — discount layer interactions, bundle expansion mechanics, term calculation, and common pitfalls — so that an ai assistant can generate correct, runnable apex code from a plain english business description (e g , "create a 24 month quote for the gem edition with 15% off, but professional services at full price") it includes five validated examples, an error to fix mapping table, and placeholder conventions for portable code setup by tool tool how to use claude code copy skill md to claude/skills/specialists/quote order api/skill md in your project it is automatically available as a specialist skill openai codex add skill md to the agent's agents md or upload it as a reference file in your codex environment the agent will use it as context when generating apex code chatgpt paste the contents of skill md into a custom gpt's instructions, or attach it as a file at the start of a conversation and ask chatgpt to follow its rules when generating apex cursor place skill md in your project root or cursor/rules/ directory reference it with @skill md in chat, or add it to your project level rules so it is always included github copilot add skill md to github/copilot instructions md or reference it as a workspace file in copilot chat with #file\ skill md new business create quote & create order 👉 overview create quote & create order global methods docid\ vjerrkfnouvv8pynr5uoa purpose the create quote and create order methods handle the initial sale — when a customer is buying products for the first time or adding entirely new subscriptions to their account these methods create fully priced quotes or orders from a simple product list, running the complete nue pricing pipeline in a single call methods method class description createquote(request) ruby globalquoteserviceapi create a new business quote with full pricing createorder(request) ruby globalorderserviceapi create a new business order with full pricing what they do you provide a list of products (by sku or name), quantities, and subscription terms the api handles product resolution — find products by sku or name, resolve the correct price book entry based on uom, currency, and pricing attributes bundle expansion — automatically include bundled items, required add ons, and dynamic product options pricing engine execution — calculate the full pricing formula list price, system discounts, discretionary discounts, tax discount propagation — apply header level discounts, propagate parent discounts to children, respect overrides price tag evaluation — evaluate tiered, volume, and ramp price/discount tags validation — enforce business rules and return structured error messages with specific error codes preview and commit both methods support two modes via the iscommit flag preview ( iscommit = false ) — runs the full pricing engine and returns calculated results without saving anything to the database use this for pricing previews, what if scenarios, and validation commit ( iscommit = true ) — runs pricing and persists the quote/order and all line items as salesforce records when to use use case recommended method deals requiring review/approval before fulfillment create quote quote to order conversion workflow create quote → generateorders() automated renewals from external systems create order system to system integrations (erp, billing) create order ai driven quote generation create quote pricing preview / what if scenarios either (preview mode) batch creation from imported data either example // create a quote with two products — the api handles bundle expansion, // pricing, and discount propagation automatically ruby globalapitypes createquoterequest request = new ruby globalapitypes createquoterequest(); request iscommit = false; request accountid = opp accountid; request quote = new quote( opportunityid = opp id, name = 'enterprise deal q1', ruby subscriptionstartdate c = date today(), ruby subscriptionterm c = 12, ruby subscriptiontermdimension c = 'month', ruby isprimaryquote c = true // ← designate as primary quote ); ruby globalapitypes productinput product = new ruby globalapitypes productinput(); product productsku = 'nue platform'; product uom = 'user/month'; product quantity = 25; request products = new list\<ruby globalapitypes productinput>{ product }; ruby globalapitypes createquoteresponse response = ruby globalquoteserviceapi createquote(request); // response status = 'succeed' // response data lineitems contains fully priced line items lifecycle changes create change quote & create change order 👉 create change quotes and orders docid\ upanqs 1lf0n z1z uh55 purpose the change order methods handle post sale lifecycle changes — when a customer needs to modify their existing subscriptions, assets, or entitlements instead of building a new quote from scratch, you specify what changes to make to existing subscriptions, and the engine calculates the financial impact prorated credits, price deltas, new term dates, and updated arr/acv metrics this is the api that powers the ongoing customer relationship — renewals, expansions, contractions, cancellations, and product swaps that happen throughout the subscription lifecycle methods method class description changeorder(changeorder) ruby globalchangeorderservice create a change quote or change order from asset change requests changeorder(changeorder, mergetypes) ruby globalchangeorderservice same, with line merging for cleaner presentation supported change types the change order framework supports a comprehensive set of lifecycle operations change type purpose example renew extend a subscription for another term renew a 12 month subscription at end of term adjustprice modify pricing on existing subscriptions apply a 5% annual uplift on renewal updatequantity change the number of seats/units expand from 25 to 50 user licenses cancel terminate a subscription cancel a product the customer no longer needs updateterm change the subscription duration convert a month to month to an annual plan coterm align end dates across subscriptions co term a new purchase to match existing renewal date newproduct cross sell additional products add a complementary product to an existing account upgrade replace with a higher tier product move from standard to enterprise edition downgrade replace with a lower tier product move from enterprise to standard edition swap exchange one product for another replace product a with product b reconfigure change add ons within a bundle add or remove optional components evergreentocoterm convert evergreen to fixed term align an open ended subscription to a co term date evergreentoupdateterm convert evergreen to a new term set a specific end date on an open ended subscription bulksubscriptionrenewal renew multiple subscriptions at once batch renew all subscriptions expiring this quarter quote vs order mode the globalchangeorderproceedoption controls what gets created createquote — generates a change quote for review before execution set activateorder = false createorder — generates a change order and optionally activates it immediately set activateorder = true to process the changes and update subscriptions, assets, and entitlements in one step useexistingquote — merges changes into an existing quote via containedobjectid , allowing multiple changes to be combined into a single document composability multiple changes in one call a key strength of the change order api is composability — you can combine multiple change types in a single call for example, renew a subscription and apply a price uplift and add a new cross sell product, all in one atomic operation ruby globalchangeorderoptions options = new ruby globalchangeorderoptions( ruby globalchangeorderproceedoption createorder ); options activateorder = true; list\<ruby globalassetchangerequest> changes = new list\<ruby globalassetchangerequest>(); // renew for 12 months ruby globalrenewrequest renew = new ruby globalrenewrequest(); renew\ assetnumber = 'sub 001234'; renew\ renewalterm = 12; changes add(renew); // apply 5% price uplift on renewal ruby globaladjustpricerequest uplift = new ruby globaladjustpricerequest(); uplift assetnumber = 'sub 001234'; uplift startdate = renewalstartdate; uplift term = 12; uplift discount = new ruby discountchange(); uplift discount discountpercentage = 5; // negative = uplift uplift discount applytochildren = true; changes add(uplift); ruby globalchangeorderresult result = service changeorder( new ruby globalchangeorder(options, changes) ); merge change lines when combining changes like renewal + price uplift, the default behavior creates separate line items for each change type the merge overload consolidates compatible changes into single line items for cleaner customer facing documents // merge renewal and price adjustment into a single line ruby globalchangeorderresult result = service changeorder( new ruby globalchangeorder(options, changes), new list\<ruby globalmergechangelinetype>{ ruby globalmergechangelinetype renew, ruby globalmergechangelinetype adjustprice } ); common use cases scenario change types used annual renewal with price increase renew + adjustprice multi year renewal with escalating uplift renew + multiple adjustprice (staggered terms) seat expansion mid term updatequantity renewal with quantity tier true up renew + adjustprice (trueupprice = true) cross sell new product co termed to existing newproduct (with cotermasset) bundle reconfiguration (add/remove add ons) reconfigure end of life product replacement upgrade, downgrade, or swap customer churn cancel consolidate subscription end dates coterm choosing the right api is this a new purchase or a change to existing subscriptions? ├── new purchase (no existing subscriptions involved) │ ├── needs review/approval? → create quote │ └── direct fulfillment? → create order │ └── change to existing subscriptions/assets ├── needs review/approval? → create change quote (proceedoption createquote) └── direct fulfillment? → create change order (proceedoption createorder) question create quote/order create change quote/order what does it operate on? products from the catalog existing subscriptions and assets input product skus, quantities, terms asset/subscription numbers, change types output new quote/order with line items change quote/order with delta line items pricing full price calculation from catalog prorated deltas, credits, uplift calculations use case initial sale, new business renewals, expansions, modifications, cancellations shared design principles both api families share these design principles semantic, not procedural you describe business intent — "add these products," "renew this subscription with a 5% uplift" — rather than manipulating individual database records the pricing engine translates intent into fully calculated financial records built for ai integration both apis return structured, machine readable responses with specific error codes, warning codes, and actionable messages this allows ai systems to interpret outcomes, self correct on failures, and minimize manual intervention in automated workflows preview before commit both support a non destructive preview mode for validating structure and pricing before persisting to the database — essential for ai driven automation where you want to verify before committing related resources create quote & create order — full documentation https //docs nue io/create quote global method — complete guide covering standalone products, bundles, discounts, price tags, multi attribute pricing, subscription terms, multi currency, custom fields, validation, and the create order api apex global methods and services https //docs nue io/apex global methods and services — full reference for all nue apex global methods including change orders, recalculation, price tag reapplication, order generation, invoice preview, and salesforce flow integration