Global API
...
Requests
Estimate

Update

1min
the following is an example of updating the estimate where we are changing some of the fields (see estimate docid\ fgc9eqdmrkfq6ct2cri5h for all available fields) the netsuite estimate id (internalid) is required to update the estimate note you can only update one record at a time the response returns the complete estimate information, but we have shortened the response in our example for ease of reading request // create a map to store all the data of an estimate map\<string, object> nsestimate = new map\<string, object>(); nsestimate put('internalid', '38310'); nsestimate put('entitystatus', new map\<string, object>{'internalid'=>'11'}); nsestimate put('expectedclosedate', datetime newinstance(2020, 10, 31) gettime()/1000); // initializing the estimate line items list\<object> lineitemlist = new list\<object>(); map\<string, object> lineitem = new map\<string, object>(); lineitem put('line', 1); // updates the existing line item with line number as 1 lineitem put('quantity', 2); lineitemlist add(lineitem); // adding another line item lineitem = new map\<string, object>(); lineitem put('item', new map\<string, object>{'internalid'=>'444'}); lineitem put('quantity', 4); lineitem put('price', new map\<string, object>{'internalid'=>'2'}); lineitemlist add(lineitem); // adding the line items to estimate map\<string, object> estimatelineitemlist = new map\<string, object>(); estimatelineitemlist put('item', lineitemlist); estimatelineitemlist put('replaceall', false); // setting this as false, would create a new, or update, the line items passed in the request based on the line number 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', 'updateestimate'); reqobj put('requestjson', reqjson); // placing a request to breadwinner global api map\<string, object> resp = breadwinner ns breadwinnernetsuiteapi call(reqobj); system debug(resp); response { &#x9;action=updateestimate, &#x9;timestamp=1599493152274, &#x9;validrequest=true, &#x9;version=1 0, &#x9;responsejson={ &#x9; "errors" \[], &#x9; "status" "200", &#x9; "estimates" \[ &#x9; { &#x9; "tranid" "98", &#x9; "trandate" 1599417000, &#x9; "total" 2019, &#x9; "title" "sf estimate", &#x9; "taxtotal" 0, &#x9; "subtotal" 2034, &#x9; "subsidiary" { &#x9; "type" null, &#x9; "name" "parent company", &#x9; "internalid" "1", &#x9; "externalid" null &#x9; }, &#x9; "status" "open", &#x9; "shippingcost" null, &#x9; "salesrep" null, &#x9; "salesforceid" "a042v00002e7wekaau", &#x9; "probability" 75, &#x9; "otherrefnum" "4343399", &#x9; "nullfieldlist" null, &#x9; "memo" "database order 25", &#x9; "lastmodifieddate" 1599493149, &#x9; "itemlist" { &#x9; "item" \[ &#x9; { &#x9; "taxrate1" 0, &#x9; "taxcode" { &#x9; "type" null, &#x9; "name" "vat in\ undef in", &#x9; "internalid" "5", &#x9; "externalid" null &#x9; }, &#x9; "tax1amt" 0, &#x9; "revrecstartdate" null, &#x9; "revrecschedule" null, &#x9; "revrecenddate" null, &#x9; "rate" "999 00", &#x9; "quantity" 2, &#x9; "price" { &#x9; "type" null, &#x9; "name" null, &#x9; "internalid" " 1", &#x9; "externalid" null &#x9; }, &#x9; "location" null, &#x9; "line" 1, &#x9; "item" { &#x9; "type" null, &#x9; "name" "bow", &#x9; "internalid" "239", &#x9; "externalid" null &#x9; }, &#x9; "grossamt" 1998, &#x9; "description" "a weapon for shooting arrows", &#x9; "department" null, &#x9; "customfieldlist" { &#x9; "customfield" \[ &#x9; { &#x9; "valuelookup" null, &#x9; "value" "false", &#x9; "scriptid" "custcol checkbox", &#x9; "internalid" "443", &#x9; "fieldtype" null &#x9; } &#x9; ] &#x9; }, &#x9; "classification" null, &#x9; "amount" 1998 &#x9; }, &#x9; { &#x9; "taxrate1" 0, &#x9; "taxcode" { &#x9; "type" null, &#x9; "name" "vat in\ undef in", &#x9; "internalid" "5", &#x9; "externalid" null &#x9; }, &#x9; "tax1amt" 0, &#x9; "revrecstartdate" null, &#x9; "revrecschedule" null, &#x9; "revrecenddate" null, &#x9; "rate" "9 00", &#x9; "quantity" 4, &#x9; "price" { &#x9; "type" null, &#x9; "name" "alternate price 1", &#x9; "internalid" "2", &#x9; "externalid" null &#x9; }, &#x9; "location" null, &#x9; "line" 4, &#x9; "item" { &#x9; "type" null, &#x9; "name" "apple", &#x9; "internalid" "444", &#x9; "externalid" null &#x9; }, &#x9; "grossamt" 36, &#x9; "description" null, &#x9; "department" null, &#x9; "customfieldlist" { &#x9; "customfield" \[ &#x9; { &#x9; "valuelookup" null, &#x9; "value" "false", &#x9; "scriptid" "custcol checkbox", &#x9; "internalid" "443", &#x9; "fieldtype" null &#x9; } &#x9; ] &#x9; }, &#x9; "classification" null, &#x9; "amount" 36 &#x9; } &#x9; ] &#x9; }, &#x9; "internalid" "38310", &#x9; "handlingcost" null, &#x9; "externalid" "sfid a012w00000oyssh", &#x9; "expectedclosedate" 1604082600, &#x9; "exchangerate" 1, &#x9; "entitystatus" { &#x9; "type" null, &#x9; "name" "in negotiation", &#x9; "internalid" "11", &#x9; "externalid" null &#x9; }, &#x9; "entity" { &#x9; "type" null, &#x9; "name" "21 atherton grocery", &#x9; "internalid" "362", &#x9; "externalid" null &#x9; }, &#x9; "duedate" 1609353000, &#x9; "discounttotal" 15, &#x9; "discountrate" " 15 00", &#x9; "discountitem" { &#x9; "type" null, &#x9; "name" "partner discount", &#x9; "internalid" " 6", &#x9; "externalid" null &#x9; }, &#x9; "department" { &#x9; "type" null, &#x9; "name" "sales", &#x9; "internalid" "2", &#x9; "externalid" null &#x9; }, &#x9; "customform" { &#x9; "type" null, &#x9; "name" "custom estimate 2", &#x9; "internalid" "124", &#x9; "externalid" null &#x9; }, &#x9; "customfieldlist" { &#x9; "customfield" \[ &#x9; { &#x9; "valuelookup" { &#x9; "type" null, &#x9; "name" "b", &#x9; "internalid" "2", &#x9; "externalid" null &#x9; }, &#x9; "value" null, &#x9; "scriptid" "custbody customlist", &#x9; "internalid" "458", &#x9; "fieldtype" null &#x9; }, &#x9; { &#x9; "valuelookup" null, &#x9; "value" "false", &#x9; "scriptid" "custbody checkbox", &#x9; "internalid" "272", &#x9; "fieldtype" null &#x9; } &#x9; ] &#x9; }, &#x9; "currencyrecord" null, &#x9; "currencyname" "us dollars", &#x9; "createddate" 1599492192, &#x9; "classification" { &#x9; "type" null, &#x9; "name" "corporate sales", &#x9; "internalid" "5", &#x9; "externalid" null &#x9; } &#x9; } &#x9; ] &#x9;} }