API Reference: Request & Response Types
31 min
this article documents every type used by the create quote and create order apex global methods all types are global inner classes of ruby globalapitypes , accessible from any apex code in the org entry points create quote ruby globalapitypes createquoteresponse response = ruby globalquoteserviceapi createquote(request); class ruby globalquoteserviceapi method global static ruby globalapitypes createquoteresponse createquote(ruby globalapitypes createquoterequest req) create order ruby globalapitypes createorderresponse response = ruby globalorderserviceapi createorder(request); class ruby globalorderserviceapi method global static ruby globalapitypes createorderresponse createorder(ruby globalapitypes createorderrequest req) request types createquoterequest the top level request object for creating a quote global class createquoterequest { global boolean iscommit; global quote quote; global list\<productinput> products; global opportunity opportunity; global id accountid; } field type required description iscommit boolean yes true = persist to database; false = pricing preview only quote quote yes the quote sobject with header fields (see quote fields below) products list\<productinput> yes one or more products to add to the quote opportunity opportunity no pass an opportunity sobject with an id to link the quote, or omit and set quote opportunityid instead accountid id no alternative way to specify the account resolved from quote accountid , accountid , or opportunity accountid (in that order) quote fields the quote field is a standard salesforce quote sobject key fields commonly used with this api are listed below for a comprehensive list of all quote fields, see the quote object definition https //api docs nue io/get object definition endpoint ( get /metadata/objects/quote ) custom fields on the quote header are also supported — see custom fields field type required default description name string yes — quote name opportunityid id yes — link to an existing opportunity required unless opportunity block is provided with an id accountid id no resolved from opportunity explicitly set the account pricebook2id id no standard price book the pricebook to use for price book entry https //docs nue io/price books resolution ruby subscriptionstartdate c date no date today() subscription start date ruby subscriptionenddate c date no calculated from start + term subscription end date ruby subscriptionterm c decimal no calculated from start/end dates subscription term https //docs nue io/understanding subscription term basis and proration in months ruby subscriptiontermdimension c string no — term dimension 'month' or 'year' ruby discount c decimal no — header level discount percentage (0–100) propagates to all lines without their own discount ruby discountamount c decimal no — header level discount amount (currency) distributed proportionally across lines ruby isprimaryquote c boolean no — whether this is the primary quote on the opportunity term calculation you can provide any two of ruby subscriptionstartdate c , ruby subscriptionenddate c , and ruby subscriptionterm c — the third is calculated automatically if only startdate is given, the default term depends on your org's system settings multi currency https //docs nue io/multiple currencies orgs set currencyisocode on the quote via quote put('currencyisocode', 'eur') if omitted, defaults to the running user's default currency createorderrequest the top level request object for creating an order mirrors createquoterequest but uses an order sobject instead of quote global class createorderrequest { global boolean iscommit; global order order; global list\<productinput> products; global id accountid; } field type required description iscommit boolean yes true = persist; false = preview order order yes the order sobject with header fields products list\<productinput> yes products to add to the order accountid id no alternative to order accountid order fields the order field is a standard salesforce order sobject key fields commonly used with this api are listed below for a comprehensive list of all order fields, see the order object definition https //api docs nue io/get object definition endpoint ( get /metadata/objects/order ) custom fields on the order header are also supported field type required default description accountid id yes — required unless accountid is provided at the request level pricebook2id id no standard price book pricebook for price book entry resolution ruby subscriptionstartdate c date no date today() subscription start date ruby subscriptionenddate c date no calculated subscription end date ruby subscriptionterm c decimal no calculated subscription term ruby subscriptiontermdimension c string no — 'month' or 'year' effectivedate date no end date or start date order effective date status string no 'draft' order status productinput defines a product to add to the quote or order for bundles https //docs nue io/product bundle , use the addons field to specify optional add on products global class productinput { // product identification (at least one of productsku or productname required) global string productsku; global string productname; global string pricebookentryid; // quantity & uom global decimal quantity; global string uom; global id uomid; // term & dates (per product overrides) global date startdate; global date enddate; global decimal subscriptionterm; global string subscriptiontermdimension; // subscription settings global boolean autorenew; global boolean evergreen; global decimal renewalterm; global string billingperiod; global string billingtiming; // discounts global decimal discount; // percentage (0 100) global decimal discountamount; // currency amount // pricing global list\<pricetaginput> pricetags; global list\<custompricingattribute> custompricingattributes; // bundle add ons global list\<productinput> addons; // custom fields global map\<string, object> customfields; } field type required description productsku string yes product sku ( stockkeepingunit ) either productsku or productname must be provided productname string yes product name used only if productsku is blank pricebookentryid string no specific pricebookentry id bypasses uom/currency resolution quantity decimal yes number of units required for root products; optional for add ons (defaults to bundle definition) uom string no unit of measure https //docs nue io/unit of measures uoms name (e g , 'user/month' ) required if pricebookentryid is not provided uomid id no uom record id (alternative to uom name) startdate date no per product start date override enddate date no per product end date override subscriptionterm decimal no per product term override (must be > 0) subscriptiontermdimension string no 'month' or 'year' autorenew boolean no override auto renewal setting evergreen boolean no mark as evergreen (no fixed term) cannot be combined with subscriptionterm or enddate renewalterm decimal no renewal term in months (must be > 0) billingperiod string no billing period override accepts both api values ( 'monthly' ) and labels ( 'month' ) billingtiming string no billing timing override (e g , 'in advance' , 'in arrears' ) discount decimal no discretionary discount percentage (0–100) discountamount decimal no discretionary discount amount (currency) if both discount and discountamount are set, discount (%) takes precedence and a warning is returned pricetags list\<pricetaginput> no price or discount tags to apply to this product custompricingattributes list\<custompricingattribute> no custom price book entry field values https //docs nue io/manage custom attributes in price book entries for price book entry filtering (not for account type auto resolution — see multi attribute pricing ) addons list\<productinput> no optional add on products for bundles each add on is itself a productinput customfields map\<string, object> no custom field values for the line item validation rules the api validates each productinput and returns structured errors rule error code description missing both productsku and productname product sku or name required at least one must be provided root product with null/negative quantity product quantity invalid quantity is required for root products add on with negative quantity product quantity invalid add on quantity can be null (uses bundle default) but not negative invalid billingperiod value product billingperiod invalid value not in the org's billingperiod picklist invalid billingtiming value product billingtiming invalid value not in the org's billingtiming picklist renewalterm <= 0 product renewalterm invalid must be greater than 0 subscriptionterm <= 0 product subscriptionterm invalid must be greater than 0 evergreen = true with subscriptionterm or enddate invalid input evergreen subscriptions cannot have a fixed term custompricingattribute used to filter pricebookentry selection by custom price book entry fields https //docs nue io/multi attribute pricing#use custom fields of price book entry as pricing a this is for price book entry custom fields used as pricing dimensions — not for account type auto resolution (which happens automatically via the pricingattribute mapping) global class custompricingattribute { global string name; // custom field api name on pricebookentry global string value; // value to match } field type required description name string yes the custom field name on pricebookentry (e g , 'storage2 c' ) value string yes the value to match (e g , '16gb' ) multiple attributes are combined with and logic — only price book entries matching all specified attributes are selected response types createquoteresponse global class createquoteresponse { global string status; // "succeed" or "failure" global quotedto data; // quote + line items (null on failure) global list\<message> warnings; // non fatal messages global list\<message> errors; // fatal errors (populated on failure) } field type description status string "succeed" on success, "failure" on validation or business logic errors data quotedto the quote and its line items null when status = "failure" warnings list\<message> non fatal warnings (e g , duplicate price tags, discount precedence) present even on succeed errors list\<message> error details populated when status = "failure" createorderresponse global class createorderresponse { global string status; // "succeed" or "failure" global orderdto data; global list\<message> warnings; global list\<message> errors; } same structure as createquoteresponse but wraps an orderdto instead quotedto global class quotedto { global quote quote; global list\<quotelineitemdto> lineitems; // flattened, depth first order } field type description quote quote the quote sobject with all calculated pricing fields has an id if iscommit=true ; null id if iscommit=false lineitems list\<quotelineitemdto> all line items in flattened, depth first order bundle parent appears first, followed by its children, then the next root product orderdto global class orderdto { global order order; global list\<orderitemdto> lineitems; } quotelineitemdto global class quotelineitemdto { global quotelineitem quotelineitem; global string id; // internal line id global string parentid; // parent line id (for bundle children) global uom uom; global lineitemproduct product; global lineitemproductoption productoption; global list\<pricingdimension> appliedpricetags; global list\<priceimpactresult> priceimpacts; } field type description quotelineitem quotelineitem the quotelineitem sobject with all pricing fields id string internal identifier for this line item parentid string internal identifier of the parent line (populated for bundle children; null for root products) uom uom the resolved unit of measure product lineitemproduct product details productoption lineitemproductoption product option details (for bundle children) appliedpricetags list\<pricingdimension> price/discount tags that were applied to this line priceimpacts list\<priceimpactresult> detailed pricing impact breakdown key quotelineitem pricing fields the following are key pricing fields returned on each quotelineitem for a comprehensive list of all quotelineitem fields, see the quotelineitem object definition https //api docs nue io/get object definition endpoint ( get /metadata/objects/quotelineitem ) custom fields on quotelineitem are not directly settable via the api — see custom fields for the two step workaround field description ruby listprice c per unit list price from the pricebookentry quantity number of units ruby subscriptionterm c term applied to this line ruby listtotalprice c listprice x quantity x term ruby systemdiscount c system discount percentage (from price/discount tags) ruby systemdiscountamount c system discount amount ruby subtotal c listtotalprice systemdiscountamount ruby netsalesprice c per unit net sales price after system discount ruby salesprice c per unit sales price ruby discount c discretionary discount percentage ruby discountamount c discretionary discount amount ruby totalprice c subtotal discountamount ruby totalamount c totalprice + taxamount product2 stockkeepingunit product sku (populated in response) ruby evergreen c whether this is an evergreen subscription ruby autorenew c auto renewal setting ruby billingperiod c billing period ruby billingtiming c billing timing ruby subscriptionstartdate c line level start date ruby subscriptionenddate c line level end date orderitemdto global class orderitemdto { global orderitem orderitem; global string id; global string parentid; global uom uom; global lineitemproduct product; global lineitemproductoption productoption; global list\<pricingdimension> appliedpricetags; global list\<priceimpactresult> priceimpacts; } same structure as quotelineitemdto but wraps an orderitem instead of quotelineitem for a comprehensive list of all orderitem fields, see the orderitem object definition https //api docs nue io/get object definition endpoint ( get /metadata/objects/orderitem ) custom fields on orderitem follow the same two step pattern as quotelineitem — commit the order first, then update line items via standard dml message used for both errors and warnings the structured format enables ai systems and integrations to programmatically interpret outcomes global class message { global string errorcode; // severity "error", "warning", or "fatal" global string errortype; // specific code (e g , "product sku or name required") global string message; // human readable description } field type description errorcode string the severity level "error" for validation errors, "warning" for non fatal warnings, "fatal" for unhandled exceptions errortype string the specific error or warning code (e g , "product quantity invalid" , "duplicate price tag" ) message string human readable description of the error or warning error codes code severity description missing parameter error a required field is missing invalid argument error conflicting field values (e g , quote accountid vs accountid ) quote name required error quote name is blank quote accountid required error no account id resolvable from quote, accountid, or opportunity quote opportunityid required error no opportunity id provided quote subscriptionterm invalid error quote ruby subscriptionterm c <= 0 product sku or name required error both productsku and productname are blank product quantity invalid error quantity is null/negative for root product, or negative for add on product pricebookentryid required error no price book entry id, uom, or custom pricing attributes provided product billingperiod invalid error unrecognized billing period value product billingtiming invalid error unrecognized billing timing value product renewalterm invalid error renewalterm <= 0 product subscriptionterm invalid error subscriptionterm <= 0 invalid input error evergreen = true with subscriptionterm or enddate invalid addon product error add on product is not a valid option for the specified bundle pricebook entry mismatch error price book entry currency doesn't match the quote currency business logic error error no matching price book entry found for the product/uom/currency combination warning codes code severity description duplicate price tag warning the same price tag was specified more than once on a product product discount applied warning both discount (%) and discountamount were set — percentage takes precedence header discount applied warning both quote ruby discount c and quote ruby discountamount c were set — percentage takes precedence product discount overrides header warning a product level discount overrides the header level discount default value applied warning a default value was applied for a missing field