Global API
...
Requests
Estimate

Create

1min
to create a customer in netsuite, use action as "createestimate" and pass the customer data in the requestjson under "estimates " note you can only create one record at a time the following is an example of creating an estimate where we are setting every possible field (see estimate docid\ fgc9eqdmrkfq6ct2cri5h for the available fields) the response will return the response from netsuite, which includes the new netsuite estimate id (internalid), plus the newly created salesforce estimate id (salesforceid) request // create a map to store all the data of an estimate map\<string, object> nsestimate = new map\<string, object>(); nsestimate put('classification', new map\<string, object>{'internalid'=>'5'}); nsestimate put('currencyrecord', new map\<string, object>{'internalid'=>'2'}); nsestimate put('customform', new map\<string, object>{'internalid'=>'124'}); nsestimate put('department', new map\<string, object>{'internalid'=>'2'}); nsestimate put('discountitem', new map\<string, object>{'internalid'=>' 6'}); nsestimate put('discountrate', ' 15'); nsestimate put('duedate', datetime newinstance(2020, 12, 31) gettime()/1000); nsestimate put('entity', new map\<string, object>{'internalid'=>'362'}); nsestimate put('entitystatus', new map\<string, object>{'internalid'=>'8'}); nsestimate put('expectedclosedate', datetime newinstance(2020, 12, 31) gettime()/1000); nsestimate put('externalid', 'sfid a012w00000oyssh'); nsestimate put('memo', 'order 25'); nsestimate put('otherrefnum', '4343399'); nsestimate put('probability', 35); nsestimate put('title', 'sf estimate'); nsestimate put('trandate', datetime newinstance(2020, 09, 07) gettime()/1000); // initializing the estimate custom fields list\<object> estcustomfieldlist = new list\<object>(); map\<string, object> estcustomfield = new map\<string, object>(); estcustomfield put('fieldtype', 'select'); estcustomfield put('scriptid', 'custbody customlist'); estcustomfield put('valuelookup', new map\<string, object>{'internalid'=>'2'}); estcustomfieldlist add(estcustomfield); // adding the estimate custom fields nsestimate put('customfieldlist', new map\<string, object>{'customfield'=>estcustomfieldlist}); // initializing the estimate line items list\<object> lineitemlist = new list\<object>(); map\<string, object> lineitem = new map\<string, object>(); lineitem put('description', 'a weapon for shooting arrows'); lineitem put('item', new map\<string, object>{'internalid'=>'239'}); lineitem put('quantity', 1); lineitem put('rate', '999'); // initializing the line item custom fields list\<object> licustomfieldlist = new list\<object>(); map\<string, object> licustomfield = new map\<string, object>(); licustomfield put('fieldtype', 'boolean'); licustomfield put('scriptid', 'custcol checkbox'); licustomfield put('value', 'true'); licustomfieldlist add(licustomfield); // adding the estimate line item custom fields lineitem put('customfieldlist', new map\<string, object>{'customfield'=>licustomfieldlist}); lineitemlist add(lineitem); // adding the line items to estimate map\<string, object> estimatelineitemlist = new map\<string, object>(); estimatelineitemlist put('item', lineitemlist); nsestimate put('itemlist', estimatelineitemlist); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('estimates', new list\<object>{nsestimate}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'createestimate'); reqobj put('requestjson', reqjson); // placing a request to breadwinner global api map\<string, object> resp = breadwinner ns breadwinnernetsuiteapi call(reqobj); system debug(resp); response { action=createestimate, timestamp=1599492195201, validrequest=true, version=1 0, responsejson={ "errors" \[], "status" "200", "estimates" \[ { "tranid" "98", "trandate" 1599417000, "total" 984, "title" "sf estimate", "taxtotal" 0, "subtotal" 999, "subsidiary" { "type" null, "name" "parent company", "internalid" "1", "externalid" null }, "status" "open", "shippingcost" null, "salesrep" null, "salesforceid" "a042v00002e7wekaau", "probability" 35, "otherrefnum" "4343399", "nullfieldlist" null, "memo" "database order 25", "lastmodifieddate" 1599492192, "itemlist" { "item" \[ { "taxrate1" 0, "taxcode" { "type" null, "name" "vat in\ undef in", "internalid" "5", "externalid" null }, "tax1amt" 0, "revrecstartdate" null, "revrecschedule" null, "revrecenddate" null, "rate" "999 00", "quantity" 1, "price" { "type" null, "name" null, "internalid" " 1", "externalid" null }, "location" null, "line" 1, "item" { "type" null, "name" "bow", "internalid" "239", "externalid" null }, "grossamt" 999, "description" "a weapon for shooting arrows", "department" null, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" "false", "scriptid" "custcol checkbox", "internalid" "443", "fieldtype" null } ] }, "classification" null, "amount" 999 } ] }, "internalid" "38310", "handlingcost" null, "externalid" "sfid a012w00000oyssh", "expectedclosedate" 1609353000, "exchangerate" 1, "entitystatus" { "type" null, "name" "in discussion", "internalid" "8", "externalid" null }, "entity" { "type" null, "name" "21 atherton grocery", "internalid" "362", "externalid" null }, "duedate" 1609353000, "discounttotal" 15, "discountrate" " 15 00", "discountitem" { "type" null, "name" "partner discount", "internalid" " 6", "externalid" null }, "department" { "type" null, "name" "sales", "internalid" "2", "externalid" null }, "customform" { "type" null, "name" "custom estimate 2", "internalid" "124", "externalid" null }, "customfieldlist" { "customfield" \[ { "valuelookup" { "type" null, "name" "b", "internalid" "2", "externalid" null }, "value" null, "scriptid" "custbody customlist", "internalid" "458", "fieldtype" null }, { "valuelookup" null, "value" "false", "scriptid" "custbody checkbox", "internalid" "272", "fieldtype" null } ] }, "currencyrecord" null, "currencyname" "us dollars", "createddate" 1599492192, "classification" { "type" null, "name" "corporate sales", "internalid" "5", "externalid" null } } ] } } if you want to include addresses while creating an estimate, please refer to the code sample create docid\ qtt9k3tcwwsrkrka2srs6