Opportunity
An opportunity record exposes an opportunity to REST web services. This record is not a subrecord. This record has one subrecord: record ID item.
The REST API Browser includes information about the field names and field types of the opportunity record. It also includes information about the HTTP methods, request parameters, and operations available to this record. For details, see the REST API Browser’s opportunity reference page.
For information about using the REST API Browser, see The REST API Browser.
Record ID
The record ID for an opportunity REST record is opportunity.
Limitations
When updating an existing Opportunity record through REST, do not include the “line” element when adding an item line.
Incorrect
"item": { "items": [{ "item": { "id": 5 }, "line": 1, "quantity": 2.0, "rate": 12.78 }]
}
Correct
"item": { "items": [{ "item": { "id": 5 }, "quantity": 2.0, "rate": 12.78 }]
}
Usage Notes
To use the Choose Team and Update Customer fields in the Sales Team subtab, the Team Selling feature must be enabled. To enable Team Selling, go to Setup > Company > Enable Features > CRM. Check the Team Selling box, and then click Save.
The Multi-Partner Management Feature must also be enabled to use the Update Customer field in the Relationships subtab. An administrator can enable the Multi-Partner Management feature at Setup > Company > Setup Tasks > Enable Features. Click the CRM subtab, and then under Partners, check the Multi-Partner Management box. Click Save.
Code Samples
These samples show typical use cases for opportunity. The sample ID is 132.
Creating an Opportunity Using a POST Request
https://0000071.suitetalk.api.snap.netsuite.com/services/rest/record/v1/opportunity
{ "altSalesRangeHigh": 0.0, "altSalesRangeLow": 0.0, "altSalesTotal": 0, "canHaveStackable": false, "competitors": { "items": [ { "competitor": { "id": "1" } } ] }, "currency": { "id": "1" }, "entity": { "id": "110" }, "entityStatus": { "id": "17" }, "exchangeRate": 1.0, "expectedCloseDate": "2023-07-13", "forecastType": { "id": "2" }, "isBudgetApproved": false, "item": { "items": [ { "fromJob": false, "isEstimate": false, "item": { "id": "98" }, "marginal": false, "printItems": false, "quantity": 4.0, "rate": 39.95 }, { "fromJob": false, "isEstimate": false, "item": { "id": "5" }, "marginal": false, "printItems": false, "rate": 954.21 } ] }, "leadSource": { "id": "-2" }, "prevDate": "2023-07-13", "probability": 10.0, "projAltSalesAmt": 0.0, "projectedTotal": 100.0, "rangeHigh": 100.0, "rangeLow": 100.0, "salesTeam": { "items": [ { "contribution": 100.00, "employee": { "id": "40" }, "isPrimary": false, "salesRole": { "id": "-2" } }, { "contribution": 100.00, "employee": { "id": "134" }, "isPrimary": true, "salesRole": { "id": "3" } } ] }, "shipIsResidential": false, "shipOverride": false, "subsidiary": {"id": "1" }, "tranDate": "2023-07-13", "weightedTotal": 10.0
}
Retrieving an Opportunity Using a GET Request
GET https://0000071.suitetalk.api.snap.netsuite.com/services/rest/record/v1/opportunity/132
Updating an Opportunity Using a PATCH Request
https://0000071.suitetalk.api.snap.netsuite.com/services/rest/record/v1/opportunity/132
{ "altSalesRangeHigh": 0.0, "altSalesRangeLow": 0.0, "altSalesTotal": 0, "canHaveStackable": false, "competitors": { "items": [ { "competitor": { "id": "1" } } ] }, "currency": { "id": "1" }, "entity": { "id": "110" }, "entityStatus": { "id": "17" }, "exchangeRate": 1.0, "expectedCloseDate": "2023-07-13", "forecastType": { "id": "2" }, "isBudgetApproved": false, "item": { "items": [ { "description": "Ergonomic Keyboard", "fromJob": false, "isEstimate": false, "item": { "id": "98" }, "line": 1, "marginal": false, "printItems": false, "quantity": 4.0, "rate": 39.95 }, { "description": "NonInvItem", "fromJob": false, "isEstimate": false, "item": { "id": "5" }, "marginal": false, "printItems": false, "rate": 954.21 } ] }, "leadSource": { "id": "-2" }, "prevDate": "2023-07-13", "probability": 10.0, "projAltSalesAmt": 0.0, "projectedTotal": 100.0, "rangeHigh": 100.0, "rangeLow": 100.0, "salesTeam": { "items": [ { "contribution": 100.00, "employee": { "id": "40" }, "isPrimary": false, "salesRole": { "id": "-2" } }, { "contribution": 100.00, "employee": { "id": "134" }, "isPrimary": true, "salesRole": { "id": "3" } } ] }, "shipIsResidential": false, "shipOverride": false, "subsidiary": {"id": "1" }, "tranDate": "2023-07-13", "weightedTotal": 10.0
}
Deleting an Opportunity Using a DELETE Request
DELETE https://0000071.suitetalk.api.snap.netsuite.com/services/rest/record/v1/opportunity/132
Setting the Sales Order's Sales Team Members to Match Sales Group 164
"salesGroup": {
"id": 164 }
Update the Customer's Partner Team to Match the Transaction Partners
"syncPartnerTeams": true
Update the Customer's Sales Team to Match the Transaction Sales Team
"syncSalesTeams": true