Order Management Rest API
The Order Management REST API allows you to create, edit, view, submit, void, unlock, and delete Orders in Veeva CRM.
You can also price Orders via the Pricing Engine. When creating or editing an Order, the submitted data is automatically run through the Pricing Engine. The system creates/updates an Order only if it meets the requirements defined by the pricing guidelines for the particular User and Organization.
Base URL
https://na1.vod309.com/172.13.10/api/v1/om/
All URLs referenced in the documentation have the following base:
https://{host}/{CRM-version}/api/v1/om/
To access {host} and {CRM-version} in Salesforce:
- 1. Navigate to the Custom Setting page.
- 2. Select Manage within the Veeva Common Custom Setting
- 3. Select Main to access the Veeva Common Detail page.
From the Veeva Common Detail Page, users can copy the Content Server for the {host} tag and the Veeva Version for the {CRM-version} tag.
Authentication
Existing Salesforce Integrations
Request
$ curl -H 'sfSession:00DT0000000JpOE!AQwAQF03ljuz2dIqVmfCGXnVpi8X7HKX_LyS8YF9b4AZoDGHmtbLJ6PA.R.Q0AUFFCN.ejFWazUKKlk8fOa8exquHQQ7C1yk' \
-H 'sfEndpoint:https://cs20.salesforce.com/Soap/u/24.0/00DT0000000JpOE' \
-u 'sjones@veeva.eng.config2:dumypasswordhere' \
'https://qa.vod309.com/16.5.4/api/v1/presentations'\
Response
Authorization: 'Basic username:password-or-dummy-password (username must be included)'
sfEndpoint: 'https://cs20.salesforce.com/services/Soap/u/24.0/avqwjk3245qvdk4s13dj'
sfSession: 'fq7axf6xqOg5yfP80Zb66xaSKudnxUvlM...'
Users can access the Veeva API by leveraging their existing Salesforce integrations. Users with systems such as a third-party single-sign on are able to access Salesforce and establish a persistent connection. From there, they can gather the requisite Salesforce session ID and Salesforce SOAP endpoint to make an API call to Veeva.
Users use these values by entering them into their endpoint’s custom header. The username should also be included in the Authorization header. The password can be left blank or filled with a dummy value.
Windows users may need to use “ around the URL and -k option after curl.
Headers
Name | Description |
---|---|
Content-Type |
application/json or application/x-www-form-urlencoded |
sfEndpoint |
SOAP endpoint is always of the form https://{Salesforce name}/services/Soap/u/{api version}/{OrgID} |
sfSession |
The ID of an active Salesforce session. A session is created after a user logs in to Salesforce successfully with a username and password. |
Body Parameters
Name | Description |
---|---|
Username |
Your Salesforce user name assigned by your administrator. |
Password |
Your Salesforce password. This can be left blank or filled with a dummy value if your sfEndpoint and sfSession are already authenticated |
Basic Authentication
Request
$ curl -X POST '{Session ID}'
-d 'APIVER=15'\
-d 'oType=auth' \
-d 'u= sjones@veeva.eng.config2' \
-d 'p= 123456' \
'https://na1.vod309.com/auth' \
Response
URL = "https://qa.vod309.com/16.5.4?ses=00DT0000000JpOE!AQwAQF03ljuz2dIqVmfCGXnVp8YF9b4AZoDGHmtbLJ6PA.R.Q0AU..."
CONTENTSRVURL = "https://vc1.vod309.com/16.5.4?ses=00DT0000000JpOE!AQwAQF03ljuz2dIqVmfCGXnVpi8X7HKX..."
If users do not have an alternative mechanism to access Salesorce, users can submit the username and password to the Veeva API.
From there, they can leverage the sfSession and sfEndpoint values from the Veeva API in their response header. If there are any further API calls on behalf of the same user, users can only send the sfSession, the sfEndpoint and the username. This improves security and performance. While the client still requires the correct Salesforce username when making an API call, users can prevent session hijacking by entering in a password with a dummy value.
No cookies will be maintained, as HTTP sessions are not considered RESTful. The Salesforce username and password can be entered through a browser or on the initial request.
Headers
Name | Description |
---|---|
Content-Type |
application/json or application/x-www-form-urlencoded |
Body Parameters
Name | Description |
---|---|
API VER |
Your Veeva API version |
oType |
Authentication Type |
Username |
Your Salesforce user name assigned by your administrator. |
Password |
Your Salesforce password associated with your assigned user name. |
Resources
Retrieving Order Details
The following endpoints enable the Client to retrieve Order details (not formatted) pertaining to either new or existing Orders.
New Order Details
{
"status": 0,
"message": "",
"metadata": {
"mode": "New",
"sobject": "Order_vod__c",
"title": "Order",
...
},
"payload": {
"AvailableShippingAddresses": [
{
"Id": "a01Z000000TuKNLIA3",
"Name": "Address line 1",
"Inactive_vod__c": false,
"Primary_vod__c": false,
"Address_line_2_vod__c": "Address line 2",
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "Address line 1 Address line 2"
},
...
{
"Id": "a01Z000000PCdfeIAD",
"Name": "Address line 1",
"Inactive_vod__c": false,
"Primary_vod__c": false,
"Address_line_2_vod__c": "Address line 2",
"City_vod__c": "city line",
"Zip_vod__c": "12345",
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "Address line 1 Address line 2, city line, 12345"
}
],
"AvailablePaymentTerms": [
"20",
"45",
"30",
"80",
"60"
],
"RecordTypeId": "012A0000000uJCxIAM",
"Ship_To_Address_vod__r": {
"Id": "a01Z000000PRt2WIAT",
"Name": "FOR APPROVED EMAIL",
"Inactive_vod__c": false,
"Primary_vod__c": true,
"State_vod__c": {
"value": "CA",
"label": "CA",
"defaultValue": false
},
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "FOR APPROVED EMAIL, CA"
},
"AvailableRecordTypes": [
{
"id": "012A0000000uJCxIAM",
"name": "Direct_vod__c",
"label": "Direct",
"developerName": "Direct_vod__c",
"isPersonType": false,
"sObjectType": "Order_vod__c",
"isActive": true,
"description": "for orders shipped directly to the customer"
},
...
{
"id": "012A0000000uJCyIAM",
"name": "Transfer_vod__c",
"label": "Transfer",
"developerName": "Transfer_vod__c",
"isPersonType": false,
"sObjectType": "Order_vod__c",
"isActive": true,
"description": "for orders made through a wholesaler"
}
],
"AvailablePayers": [
{
"Id": "a2cZ0000001JPMJIA4",
"Name": "AmanPayer",
"Account_Partner_ID_vod__c": "12345",
}
],
"AvailableContracts": [
{
"default": false,
"productBound": false,
"Id": "a21Z0000000OT9vIAG",
"Name": "Sales Contract",
"Contract_Lines_vod__r": [],
"Default_vod__c": false,
"Product_Bound_vod__c": false,
"Wholesaler_vod__c": "001Z000000vo2WHIAY"
}
],
"type": "Order_vod__c",
"Kit_Components_Fixed_vod__c": true,
"AvailableAffiliations": [
{
"Id": "a0cZ0000004iAMHIA2",
"To_Account_vod__r": {
"Id": "001Z000000vo2WCIAY",
"Formatted_Name_vod__c": "Generic Wholesaler"
}
},
{
"Id": "a0cZ0000004iAMMIA2",
"To_Account_vod__r": {
"Id": "001Z000000vo2WMIAY",
"Formatted_Name_vod__c": "Generic Wholesaler 2"
}
}
],
"Ship_To_Address_vod__c": "a01Z000000PRt2WIAT",
"AvailableBillingAddresses": [
{
"Id": "a01Z000000TuKNLIA3",
"Name": "Address line 1",
"Inactive_vod__c": false,
"Primary_vod__c": false,
"Address_line_2_vod__c": "Address line 2",
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "Address line 1 Address line 2"
},
...
{
"Id": "a01Z000000PCdfeIAD",
"Name": "Address line 1",
"Inactive_vod__c": false,
"Primary_vod__c": false,
"Address_line_2_vod__c": "Address line 2",
"City_vod__c": "city line",
"Zip_vod__c": "12345",
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "Address line 1 Address line 2, city line, 12345"
}
],
"RecordType": {
"id": "012A0000000uJCxIAM",
"name": "Direct_vod__c",
"label": "Direct",
"developerName": "Direct_vod__c",
"isPersonType": false,
"sObjectType": "Order_vod__c",
"isActive": true,
"description": "for orders shipped directly to the customer"
},
"Account_vod__c": "001Z000000avoIHIAY",
"Billing_Address_vod__c": "a01Z000000PRt2WIAT",
"AvailableDeliveryLocations": [
{
"Id": "a2cZ0000001JPMTIA4",
"Name": "AmanDelivery",
"Account_Partner_ID_vod__c": "AmanDeliveryId",
},
{
"Id": "a2cZ0000001KfDEIA0",
"Name": "Delivery2",
}
],
"AvailableOrderLines": {
"OrderLines": [
{
"Product_vod__c": "a00Z000000GGoTYIA1",
"AvailableLinePayments": [],
"AvailableBrandPayments": [],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000GGoTYIA1",
"Name": "Market_1_Product_6 Order",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"BrandId": "a00Z000000GGoN6IAL",
"GroupIds": [],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [],
"CalculatedFields": {
"List_Price_Rule_vod__c": "6.0"
}
},
...
{
"Product_vod__c": "a00Z000000GGoTaIAL",
"AvailableLinePayments": [],
"AvailableBrandPayments": [],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000GGoTaIAL",
"Name": "Market_1_Product_8 Order",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"BrandId": "a00Z000000GGoN8IAL",
"GroupIds": [
"a00Z000000J5TEFIA3"
],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [],
"CalculatedFields": {
"List_Price_Rule_vod__c": "8.0"
}
}
],
"KitParentsToKitItems": {
"a00Z000000GGoTIIA1": [
{
"Product_vod__c": "a00Z000000GGoQ4IAL",
"Quantity_vod__c": "5.0",
"AvailableLinePayments": [],
"AvailableBrandPayments": [],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000GGoQ4IAL",
"Name": "Market_0_Product_0 Kit Item",
"Product_Type_vod__c": "Kit Item",
"Pricing_Bound_vod__c": false,
"GroupIds": [],
"KitParentId": "a00Z000000GGoTIIA1",
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [],
"CalculatedFields": {
"List_Price_Rule_vod__c": "1.0"
}
}
]
}
},
"Billing_Address_vod__r": {
"Id": "a01Z000000PRt2WIAT",
"Name": "FOR APPROVED EMAIL",
"Inactive_vod__c": false,
"Primary_vod__c": true,
"State_vod__c": {
"value": "CA",
"label": "CA",
"defaultValue": false
},
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "FOR APPROVED EMAIL, CA"
},
"Account_vod__r": {
"Id": "001Z000000avoIHIAY",
"Name": "Aman 中文",
"Account_Group_vod__c": "Test Group",
"Order_Type_vod__c": "Direct_vod;Transfer_vod;Tim;Multi Recipient",
"Default_Order_Type_vod__c": "Direct_vod",
"Formatted_Name_vod__c": "Aman 中文,",
"RecordType": {
"id": "012A0000000uJCSIA2",
"name": "Professional_vod__c",
"label": "Professional",
"developerName": "Professional_vod__c",
"isPersonType": true,
"sObjectType": "Account",
"isActive": true,
"description": "Medical Professional"
}
},
"AvailableCampaigns": [
{
"default": false,
"Id": "a1NZ0000000ixhQMAQ",
"Name": "20 Percent Rule Campaign",
"Default_vod__c": false,
"Order_Record_Type_vod__c": "All_vod",
"Order_Campaign_Bound_vod__c": false
}
],
"Order_Date_vod__c": "8/31/2015",
"AvailableWholesalers": [
{
"Id": "001Z000000vo2WMIAY",
"Name": "Generic Wholesaler"
},
{
"Id": "001Z000000vo2WCIAY",
"Name": "Generic Wholesaler 2"
}
]
}
}
To retrieve new Order details, make an HTTP GET
request to the following endpoint:
GET: {base-URL}/orders?accountId={accountId}
Actions
This endpoint retrieves new Order details. It will return Order header fields like selected Account, Record Types, Addresses, Campaigns, Contracts, and pre-populated default values, as well as the available Order Lines that the user can select.
Parameters
Required
The client must include the following parameter(s):
accountId
- ID of the Account that this Order will belong to
Optional
The following parameters are optional. If you don’t provide a value, the system will use its default value (if one exists):
orderDate
- Date selected for the Order; must be formatted according to the user’s locale or ISO-8601 compliant. If left blank, this defaults to the current date.recordTypeId
- ID or Developer Name of the selected Record Type for this OrdercampaignId
- ID of the selected Campaign for this OrdercontractId
- ID of the selected Contract for this OrderaccountGroup
- Name of the Account Group for this OrdercurrencyISOCode
- Currency code to be used for the Order
Edit Order Details
To retrieve Order details for an existing Order, make an HTTP GET
request to the following endpoint:
GET: {base-URL}/orders/{orderId}?mode=review
Actions
This endpoint retrieves Edit Order Details. This will return Order Header fields like the selected Account, Record Types, Addresses, Campaigns, Contracts, as well as the available Order Lines that the user can select.
Parameters
Required
The client must include the following parameter(s):
mode
- Mode for this request, which should have the valuereview
Optional
The following parameters are optional. If no value is provided, the system will use the value that currently exists on the Order:
orderDate
- Selected date for the Order; must be formatted according to the user’s locale or ISO-8601 compliant. If left blank, this field defaults to the current date.recordTypeId
- ID or Developer Name of the selected Record Type for this OrdercampaignId
- ID of the selected Campaign for this OrdercontractId
- ID of the selected Contract for this OrderaccountGroup
- Name of the Account Group for this OrdercurrencyISOCode
- Currency code to be used for the Order
{
"status": 0,
"message": "",
"metadata": {
"mode": "Edit",
"sobject": "Order_vod__c",
"title": "Order",
...
},
"payload": {
"Order_List_Amount_vod__c": "1500000.00",
"zvod_Delivery_Total_Quantity_vod__c": "false",
"A_Custom_Text__c": null,
"RecordTypeId": "012A0000000uJCxIAM",
"Payment_vod__c": "25",
"Call2_vod__c": null,
"Account_Group_vod__c": "Test Group",
"AvailableContracts": [
{
"default": false,
"productBound": false,
"Id": "a21Z0000000OT9vIAG",
"Name": "Sales Contract",
"Contract_Lines_vod__r": [],
"Default_vod__c": false,
"Product_Bound_vod__c": false,
"Wholesaler_vod__c": "001Z000000vo2WHIAY"
}
],
"Wholesaler_vod__c": null,
"type": "Order_vod__c",
"Order_Total_Quantity_vod__c": "15",
"Contract_vod__c": null,
"Kit_Components_Fixed_vod__c": true,
"Throw_Validation_Error__c": "false",
"Order_Lines_vod__r": [
{
"Override_Lock_vod__c": "false",
"Payment_Brand_vod__c": "Brand1",
"Free_Goods_vod__c": "10",
"Final_Net_Price_vod__c": "90000.00",
"Line_Discount_Rule_vod__c": "10.00",
"Final_Net_Price_Rule_vod__c": "90000.00",
"Trigger_Validation_Rule__c": "false",
"Net_Price_vod__c": "90000.00",
"Quantity_vod__c": "15",
"Product_vod__r": {
"Name": "Order Product Order",
"Id": "a00Z000000J4sVoIAJ",
"type": "Product_vod__c"
},
"Total_Payment_vod__c": "25",
"Total_Payment_Rule_vod__c": "25",
"Free_Goods_Rule_vod__c": "10",
"type": "Order_Line_vod__c",
"Net_Price_Rule_vod__c": "90000.00",
"Name": "OL000000494",
"Rule_vod__c": "Qty > 0, 10 FG;;",
"Total_Discount_Rule_vod__c": "10.00",
"Payment_Brand_Rule_vod__c": "Brand1",
"Line_Discount_vod__c": "10.00",
"Total_Discount_vod__c": "10.00",
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Net_Amount_vod__c": "1350000.00",
"Id": "a1GZ0000002ZEGfMAO",
"List_Price_Rule_vod__c": "100000.00",
"List_Amount_vod__c": "1500000.00"
}
],
"Payment_Rule_vod__c": "25",
"Disclaimer_vod__c": null,
"Delivery_Order_vod__c": "false",
"Call2_vod__r": {},
"Wholesaler_vod__r": {},
"Contract_vod__r": null,
"Wholesaler_Account_Partner_vod__c": null,
"RecordType": {
"id": "012A0000000uJCxIAM",
"name": "Direct_vod__c",
"label": "Direct",
"developerName": "Direct_vod__c",
"isPersonType": false,
"sObjectType": "Order_vod__c",
"isActive": true,
"description": "for orders shipped directly to the customer"
},
"CurrencyIsoCode": null,
"Status_vod__c": "Saved_vod",
"Billing_Address_vod__c": null,
"Billing_Contact_vod__c": null,
"Payer_vod__r": {},
"Order_Total_Discount_vod__c": "10.00",
"AvailableDeliveryLocations": [
{
"Id": "a2cZ0000001JPMTIA4",
"Name": "AmanDelivery",
"Account_Partner_ID_vod__c": "AmanDeliveryId",
"Contract_vod__c": null
},
{
"Id": "a2cZ0000001KfDEIA0",
"Name": "Delivery2",
"Account_Partner_ID_vod__c": null,
"Contract_vod__c": null
}
],
"Delivery_Date_vod__c": null,
"AvailableOrderLines": {
"OrderLines": [
{
"Product_vod__c": "a00Z000000GGoTYIA1",
"AvailableLinePayments": [],
"AvailableBrandPayments": [],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000GGoTYIA1",
"Name": "Market_1_Product_6 Order",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"BrandId": "a00Z000000GGoN6IAL",
"GroupIds": [],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [],
"CalculatedFields": {
"List_Price_Rule_vod__c": "6.0"
}
},
...
{
"Product_vod__c": "a00Z000000GGoTaIAL",
"AvailableLinePayments": [],
"AvailableBrandPayments": [],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000GGoTaIAL",
"Name": "Market_1_Product_8 Order",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"BrandId": "a00Z000000GGoN8IAL",
"GroupIds": [
"a00Z000000J5TEFIA3"
],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [],
"CalculatedFields": {
"List_Price_Rule_vod__c": "8.0"
}
}
],
"KitParentsToKitItems": {
"a00Z000000GGoTIIA1": [
{
"Product_vod__c": "a00Z000000GGoQ4IAL",
"Quantity_vod__c": "5.0",
"AvailableLinePayments": [],
"AvailableBrandPayments": [],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000GGoQ4IAL",
"Name": "Market_0_Product_0 Kit Item",
"Product_Type_vod__c": "Kit Item",
"Pricing_Bound_vod__c": false,
"GroupIds": [],
"KitParentId": "a00Z000000GGoTIIA1",
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [],
"CalculatedFields": {
"List_Price_Rule_vod__c": "1.0"
}
}
]
}
},
"Notes_vod__c": "Editing Order Free Goods Override",
"Wholesaler_Account_Partner_vod__r": {},
"Billing_Address_vod__r": {},
"Order_Discount_vod__c": null,
"Order_Campaign_vod__c": null,
"Id": "a1HZ0000001D139MAC",
"Delivery_Order_Warning_vod__c": null,
"AvailableCampaigns": [
{
"default": false,
"Id": "a1NZ0000000ixhQMAQ",
"Name": "20 Percent Rule Campaign",
"Default_vod__c": false,
"Order_Record_Type_vod__c": "All_vod__c",
"Account_Type_vod__c": null,
"Account_Group_vod__c": null,
"Order_Campaign_Bound_vod__c": false
}
],
"AvailableWholesalers": [
{
"Id": "001Z000000vo2WMIAY",
"Name": "Generic Wholesaler"
},
{
"Id": "001Z000000vo2WCIAY",
"Name": "Generic Wholesaler 2"
}
],
"Order_Date_vod__c": "8/25/2015",
"Payer_vod__c": null,
"zvod_Delivery_Net_Amount_vod__c": "false",
"AvailableShippingAddresses": [
{
"Id": "a01Z000000TuKNLIA3",
"Name": "Address line 1",
"Inactive_vod__c": false,
"Primary_vod__c": false,
"Address_line_2_vod__c": "Address line 2",
"City_vod__c": null,
"State_vod__c": null,
"Zip_vod__c": null,
"Zip_4_vod__c": null,
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "Address line 1 Address line 2"
},
...
{
"Id": "a01Z000000PCdfeIAD",
"Name": "Address line 1",
"Inactive_vod__c": false,
"Primary_vod__c": false,
"Address_line_2_vod__c": "Address line 2",
"City_vod__c": "city line",
"State_vod__c": null,
"Zip_vod__c": "12345",
"Zip_4_vod__c": null,
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "Address line 1 Address line 2, city line, 12345"
}
],
"zvod_A_Phone__c": null,
"AvailablePaymentTerms": [
"20",
"45",
"30",
"80",
"60"
],
"Ship_To_Address_vod__r": {},
"Parent_Order_vod__r": {},
"zvod_BA_tim_Required_Text_Area__c": null,
"zvod_Delivery_Date_vod__c": "false",
"zvod_Delivery_List_Amount_vod__c": "false",
"Delivery_Location_vod__r": {},
"Order_Net_Amount_vod__c": "1350000.00",
"AvailableRecordTypes": [
{
"id": "012A0000000uJCxIAM",
"name": "Direct_vod__c",
"label": "Direct",
"developerName": "Direct_vod__c",
"isPersonType": false,
"sObjectType": "Order_vod__c",
"isActive": true,
"description": "for orders shipped directly to the customer"
},
...
{
"id": "012A0000000uJCyIAM",
"name": "Transfer_vod__c",
"label": "Transfer",
"developerName": "Transfer_vod__c",
"isPersonType": false,
"sObjectType": "Order_vod__c",
"isActive": true,
"description": "for orders made through a wholesaler"
}
],
"AvailablePayers": [
{
"Id": "a2cZ0000001JPMJIA4",
"Name": "AmanPayer",
"Account_Partner_ID_vod__c": "12345",
"Contract_vod__c": null
}
],
"Order_Campaign_vod__r": null,
"Signature_Date_vod__c": null,
"AvailableAffiliations": [
{
"Id": "a0cZ0000004iAMHIA2",
"Name": null,
"To_Account_vod__r": {
"Id": "001Z000000vo2WCIAY",
"Name": null,
"Formatted_Name_vod__c": "Generic Wholesaler 2"
}
},
{
"Id": "a0cZ0000004iAMMIA2",
"Name": null,
"To_Account_vod__r": {
"Id": "001Z000000vo2WMIAY",
"Name": null,
"Formatted_Name_vod__c": "Generic Wholesaler"
}
}
],
"Ship_To_Address_vod__c": null,
"AvailableBillingAddresses": [
{
"Id": "a01Z000000TuKNLIA3",
"Name": "Address1",
"Inactive_vod__c": false,
"Primary_vod__c": false,
"Address_line_2_vod__c": "Address2",
"City_vod__c": null,
"State_vod__c": null,
"Zip_vod__c": null,
"Zip_4_vod__c": null,
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "Address1 Address2"
},
...
{
"Id": "a01Z000000PCdfeIAD",
"Name": "Address line 1",
"Inactive_vod__c": false,
"Primary_vod__c": false,
"Address_line_2_vod__c": "Address line 2",
"City_vod__c": "city line",
"State_vod__c": null,
"Zip_vod__c": "12345",
"Zip_4_vod__c": null,
"Shipping_vod__c": false,
"Billing_vod__c": false,
"DisplayName": "Address line 1 Address line 2, city line, 12345"
}
],
"Warning_vod__c": null,
"Account_vod__c": "001Z000000avoIHIAY",
"Activate_Workflow_vod__c": "false",
"Order_Total_Profit_vod__c": null,
"zvod_Delivery_Address_vod__c": "false",
"Name": "OR00000375",
"Parent_Order_vod__c": null,
"A_Custom_Number__c": null,
"Delivery_Location_vod__c": null,
"Account_vod__r": {
"Id": "001Z000000avoIHIAY",
"Name": "Aman 中文",
"Account_Group_vod__c": "Test Group",
"Order_Type_vod__c": "Direct_vod__c;Transfer_vod__c;Tim;Multi Recipient",
"Default_Order_Type_vod__c": "Direct_vod__c",
"No_Orders_vod__c": null,
"Formatted_Name_vod__c": "Aman 中文,",
"RecordType": {
"id": "012A0000000uJCSIA2",
"name": "Professional_vod__c",
"label": "Professional",
"developerName": "Professional_vod__c",
"isPersonType": true,
"sObjectType": "Account",
"isActive": true,
"description": "Medical Professional"
}
}
}
}
Viewing an Order
The following endpoint enables the Client to view the formatted Order Details for a particular Order. The formatting is done on the Server and is formatted according to the user’s locale.
To View an Order, make an HTTP GET
request to the following endpoint:
GET: {base-URL}/orders/{orderId}
Actions
Endpoint to view formatted Order Details. This will return the relevant Order Header and Order Line fields that are on the layout.
{
"status": 0,
"message": "",
"metadata": {
"mode": "View",
"sobject": "Order_vod__c",
"title": "Order",
...
},
"payload": {
"zvod_Delivery_Total_Quantity_vod__c": "false",
"Order_List_Amount_vod__c": "$ 1,500,000.00",
"RecordTypeId": "012A0000000uJCxIAM",
"A_Custom_Text__c": null,
"Payment_vod__c": "25",
"LastModifiedDate": "8/31/2015 10:39 AM",
"Call2_vod__c": null,
"LastModifiedBy": {
"Name": "Admin User华琴",
"Id": "005A0000001HDjVIAW",
"type": "User"
},
"Account_Group_vod__c": "Test Group",
"Wholesaler_vod__c": null,
"type": "Order_vod__c",
"Order_Total_Quantity_vod__c": "15",
"Contract_vod__c": null,
"Throw_Validation_Error__c": "false",
"Order_Lines_vod__r": [
{
"Final_Net_Price_vod__c": "$ 90,000.00",
"Line_Discount_Rule_vod__c": "10.00%",
"Final_Net_Price_Rule_vod__c": "$ 90,000.00",
"Quantity_vod__c": "15",
"LastModifiedDate": "8/31/2015 10:39 AM",
"Total_Payment_vod__c": "25",
"Product_vod__r": {
"Name": "Order Product Order",
"Id": "a00Z000000J4sVoIAJ",
"type": "Product_vod__c"
},
"Free_Goods_Rule_vod__c": "10",
"type": "Order_Line_vod__c",
"Total_Discount_Rule_vod__c": "10.00%",
"Rule_vod__c": "Qty > 0, 10 FG;;",
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Total_Discount_vod__c": "10.00%",
"List_Price_Rule_vod__c": "$ 100,000.00",
"List_Amount_vod__c": "$ 1,500,000.00",
"Delivery_Quantity_vod__c": "25",
"Override_Lock_vod__c": "false",
"Free_Goods_vod__c": "10",
"Payment_Brand_vod__c": "Brand1",
"Trigger_Validation_Rule__c": "false",
"Net_Price_vod__c": "$ 90,000.00",
"Total_Payment_Rule_vod__c": "25",
"Net_Price_Rule_vod__c": "$ 90,000.00",
"Name": "OL000000494",
"Payment_Brand_Rule_vod__c": "Brand1",
"Line_Discount_vod__c": "10.00%",
"Net_Amount_vod__c": "$ 1,350,000.00",
"CreatedDate": "8/30/2015 12:55 PM",
"Id": "a1GZ0000002ZEGfMAO"
}
],
"Disclaimer_vod__c": null,
"Payment_Rule_vod__c": "25",
"Delivery_Order_vod__c": "false",
"Call2_vod__r": {},
"Wholesaler_vod__r": {},
"Contract_vod__r": {},
"Wholesaler_Account_Partner_vod__c": null,
"RecordType": {
"Name": "Direct",
"Id": "012A0000000uJCxIAM",
"type": "RecordType"
},
"Status_vod__c": "Saved",
"Billing_Address_vod__c": null,
"Billing_Contact_vod__c": null,
"Payer_vod__r": {},
"Order_Total_Discount_vod__c": "10.00%",
"Delivery_Date_vod__c": null,
"Notes_vod__c": "Editing Order Free Goods Override",
"Wholesaler_Account_Partner_vod__r": {},
"CreatedById": "005A0000001HDjVIAW",
"Billing_Address_vod__r": {},
"Order_Discount_vod__c": null,
"Order_Campaign_vod__c": null,
"Id": "a1HZ0000001D139MAC",
"Delivery_Order_Warning_vod__c": null,
"Order_Date_vod__c": "8/25/2015",
"Payer_vod__c": null,
"zvod_Delivery_Net_Amount_vod__c": "false",
"zvod_A_Phone_vod__c": null,
"Ship_To_Address_vod__r": {},
"Parent_Order_vod__r": {},
"zvod_Delivery_Date_vod__c": "false",
"zvod_BA_tim_Required_Text_Area__c": null,
"zvod_Delivery_List_Amount_vod__c": "false",
"Delivery_Location_vod__r": {},
"Order_Net_Amount_vod__c": "$ 1,350,000.00",
"Order_Campaign_vod__r": {},
"Signature_Date_vod__c": null,
"Ship_To_Address_vod__c": null,
"Warning_vod__c": null,
"LastModifiedById": "005A0000001HDjVIAW",
"Account_vod__c": "001Z000000avoIHIAY",
"Activate_Workflow__c": "false",
"Order_Total_Profit_vod__c": null,
"Name": "OR00000375",
"zvod_Delivery_Address_vod__c": "false",
"Parent_Order_vod__c": null,
"A_Custom_Number__c": null,
"CreatedDate": "8/30/2015 12:55 PM",
"CreatedBy": {
"Name": "Admin User华琴",
"Id": "005A0000001HDjVIAW",
"type": "User"
},
"Delivery_Location_vod__c": null,
"Account_vod__r": {
"Name": "Aman 中文",
"Id": "001Z000000avoIHIAY",
"type": "Account"
}
}
}
Deleting an Order
To delete an Order, make an HTTP DELETE
request to the following endpoint:
DELETE: {base-URL}/orders/{orderId}
Actions
Endpoint to Delete an existing Order.
{
"status": 0,
"message": "'1' record(s) deleted",
"data": {}
}
Order Status
Retrieve Order Status
To retrieve the current Order status and next possible states for the Order status, make an HTTP GET
to the following endpoint:
GET: {base-URL}/orders/{orderId}/status
Actions
Endpoint to retrieve the current Order status and the next possible states for the Order status.
{
"status": 0,
"message": "",
"data": {
"AvailableOrderStatus": [
"Submitted_vod__c",
"Voided_vod__c"
],
"Links": [
{
"rel": "Submitted_vod__c",
"link": "om/orders/a1H3B0000008OXKUA2/status"
},
{
"rel": "Voided_vod__c",
"link": "om/orders/a1H3B0000008OXKUA2/status"
}
],
"Status_vod__c": "Saved_vod__c",
"Id": "a1H3B0000008OXKUA2"
}
}
Submitting an Order
To Submit an existing Order, make an HTTP PUT
request to the following endpoint:
GET: {base-URL}/orders/{orderId}/status
Actions
The client must include a payload with Status_vod__c
set to Submitted_vod__c
. This will mark the Order as Submitted_vod__c
. The Order will be locked, and no data can be updated.
Request:
{
"type": "Order_vod__c",
"Status_vod__c": "Submitted_vod__c"
}
Response:
{
"status": 0,
"message": "'1' record(s) updated",
"data": {
"Id": "a1HZ0000001D1EiMAK"
}
}
Voiding an Order
To Void (soft delete) an existing Order, make an HTTP PUT
request to the following endpoint:
GET: {base-URL}/orders/{orderId}/status
Actions
The client must include a payload with Status_vod__c
set to Voided_vod__c
. This will mark the Order as Voided_vod__c
. The Order will be locked, and no data can be updated.
Request:
{
"type": "Order_vod__c",
"Status_vod__c": "Voided_vod__c"
}
Response:
{
"status": 0,
"message": "'1' record(s) updated",
"data": {
"Id": "a1HZ0000001D1EiMAK"
}
}
Unlocking an Order
To Unlock an existing Order, make an HTTP PUT
request to the following endpoint:
PUT: {base-URL}/orders/{orderId}/status
Actions
The client must include a payload with Status_vod__c
set to Saved_vod__c
. This will unlock an Order and mark it as Saved_vod__c
.
Example Request
{
"type": "Order_vod__c",
"Status_vod__c": "Saved_vod__c"
}
Example Response
{
"status": 0,
"message": "'1' record(s) updated",
"data": {
"Id": "a1HZ0000001D1EiMAK"
}
}
Creating/Editing Orders
The following endpoints enable the Client to save/submit New or Existing Orders to Veeva CRM. The endpoints can also be used to validate Order data (done automatically through the Pricing Engine).
Creating a New Order
To create a New Order make an HTTP POST
request to the following endpoint:
POST: {base-URL}/orders
Actions
Endpoint to price or save a New Order to Veeva CRM. When saving, the Order is automatically validated based on the Pricing Rules defined for the User and Organization.
Parameters
The following parameters are optional:
save
- Simply include the save flag as a query parameter to save the Order to Veeva CRM (no value required). If not included, then the Order will not be saved (can be used to price).
Required Payload Fields - The following fields must be present in the payload (data) sent to the Server:
"type": "Order_vod__c"
"Account_vod__c": "<Account-Id>"
For Order Lines:
"type": "Order_Line_vod__c"
Note: Date fields need to be sent in the user’s local format. An appropriate error will be returned if this specification is not met.
Example: Valid Save
Request
This request details how to save an Order to Veeva CRM. The response returned contains a record creation message, along with the ID of the newly created Order.
{
"type": "Order_vod__c",
"Notes_vod__c": "Saving Order",
"Account_vod__c": "001Z000000avoIH",
"Order_Date_vod__c": "08/25/2015",
"Order_Lines_vod__r": [
{
"type": "Order_Line_vod__c",
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "15"
}
]
}
Response
{
"status": 0,
"message": "'1' record(s) created",
"data": {
"Id": "a1HZ0000001D1EiMAK"
}
}
Example: Pricing Request without Pricing Errors
This request details how to Price (validate) an Order before saving it to Veeva CRM. The response returned contains the updated Order Header fields like the Order Total Quantity, Net Amount, List Amount, etc. The response also contains updated fields for all Order Lines, with applied Pricing suggestions, warnings, discounts, free goods, etc.
Note: If incorrect Order Lines are submitted in the payload, they will be ignored. This can happen when any Pricing relevant field is changed. Pricing relevant fields control the Order Lines that can be selected by the user. The following fields are Pricing relevant:
Account_vod__c
- Account ID for the OrderOrder_Date_vod__c
- Order dateOrder_Campaign_vod__c
- ID of the selected CampaignContract_vod__c
- ID of the selected ContractRecordTypeId
- ID or Developer Name of the selected Record Type for this OrderAccount_Group_vod__c
- Name of the Account Group that the Account belongs toCurrencyISOCode
- Currency for this Order
Request
{
"type": "Order_vod__c",
"Notes_vod__c": "Saving Order",
"Account_vod__c": "001Z000000avoIH",
"Order_Date_vod__c": "08/25/2015",
"Order_Lines_vod__r": [
{
"type": "Order_Line_vod__c",
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "15"
}
]
}
Response
{
"status": 0,
"message": "",
"data": {
"Order_List_Amount_vod__c": "1500000.0",
"Payment_vod__c": "25",
"Payment_Rule_vod__c": "25",
"Order_Net_Amount_vod__c": "1350000.0",
"Order_Total_Quantity_vod__c": "15.0",
"Order_Total_Discount_vod__c": "10.00",
"Order_Lines_vod__r": [
{
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "15",
"Net_Price_vod__c": "100000.0",
"Free_Goods_vod__c": "10.0",
"AvailableLinePayments": [],
"AvailableBrandPayments": [
"Brand1",
"Brand2"
],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000J4sVoIAJ",
"Name": "Order Product Order",
"Product_Identifier_vod__c": "UserDefined",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"Description_vod__c": "Second",
"BrandId": "a00Z000000HkfDkIAJ",
"GroupIds": [],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [
"Suggestion range: 10-20"
],
"CalculatedFields": {
"Final_Net_Price_vod__c": "90000.0",
"Line_Discount_Rule_vod__c": "10.000002",
"Payment_vod__c": null,
"Final_Net_Price_Rule_vod__c": "90000.0",
"Total_Payment_vod__c": "25",
"Free_Goods_Rule_vod__c": "10.0",
"U_M_vod__c": null,
"Brand_Warning_vod__c": null,
"Group_Warning_vod__c": null,
"Total_Discount_Rule_vod__c": "10.000002",
"Rule_vod__c": "Qty > 0, 10 FG;;",
"Order_Discount_Rule_vod__c": null,
"Total_Discount_vod__c": "10.000002",
"Payment_Rule_vod__c": null,
"List_Price_Rule_vod__c": "100000.0",
"Payment_Group_Rule_vod__c": null,
"List_Amount_vod__c": "1500000.0",
"Payment_Group_vod__c": null,
"Delivery_Quantity_vod__c": null,
"Payment_Brand_vod__c": "Brand1",
"Free_Goods_vod__c": "10.0",
"Group_Discount_Rule_vod__c": null,
"Brand_Discount_Rule_vod__c": null,
"Net_Price_vod__c": "90000.0",
"Line_Warning_vod__c": null,
"Discount_Calculation_Path_vod__c": null,
"Total_Payment_Rule_vod__c": "25",
"Net_Price_Rule_vod__c": "90000.0",
"Product_Group_vod__c": null,
"Payment_Brand_Rule_vod__c": "Brand1",
"Line_Discount_vod__c": "10.000002",
"Net_Amount_vod__c": "1350000.0",
"Net_Amount_Rule_vod__c": "1350000.0",
"Order_Discount_vod__c": null
}
}
]
}
}
Example: Pricing Request with Pricing Errors
This request details how to Price Orders (just like the one above). However, in this request, the Order Lines submitted have Pricing Errors, which would prevent saving this Order to Veeva CRM. The Client must correct the data as per the suggestions listed in PricingErrorsAndWarnings
. All Order Lines with errors will show up under Errors
in the payload for convenient access.
Request
{
"type": "Order_vod__c",
"Notes_vod__c": "Saving Order",
"Account_vod__c": "001Z000000avoIH",
"Order_Date_vod__c": "08/25/2015",
"Order_Lines_vod__r": [
{
"type": "Order_Line_vod__c",
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "155"
}
]
}
Response
{
"status": -4,
"message": "Review all error messages below to correct your data.",
"data": {
"Order_List_Amount_vod__c": "3000000.0",
"Order_Net_Amount_vod__c": "2700000.0",
"Order_Total_Quantity_vod__c": "30.0",
"Order_Total_Discount_vod__c": "10.00",
"Errors": {
"a00Z000000J4sVoIAJ": {
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "30",
"Net_Price_vod__c": "100000.0",
"Free_Goods_vod__c": "10.0",
"AvailableLinePayments": [],
"AvailableBrandPayments": [
"Brand1",
"Brand2"
],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000J4sVoIAJ",
"Name": "Order Product Order",
"Product_Identifier_vod__c": "UserDefined",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"Description_vod__c": "Second",
"BrandId": "a00Z000000HkfDkIAJ",
"GroupIds": [],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [
{
"Message": "Need total between 1 and 20",
"Error": true
}
],
"FieldErrors": [],
"Suggestions": [],
"CalculatedFields": {
"Final_Net_Price_vod__c": "90000.0",
"Line_Discount_Rule_vod__c": "10.000002",
"Payment_vod__c": null,
"Final_Net_Price_Rule_vod__c": "90000.0",
"Total_Payment_vod__c": "Brand1",
"Free_Goods_Rule_vod__c": "10.0",
"U_M_vod__c": null,
"Brand_Warning_vod__c": null,
"Group_Warning_vod__c": null,
"Total_Discount_Rule_vod__c": "10.000002",
"Rule_vod__c": "Qty > 0, 10 FG;",
"Order_Discount_Rule_vod__c": null,
"Total_Discount_vod__c": "10.000002",
"Payment_Rule_vod__c": null,
"List_Price_Rule_vod__c": "100000.0",
"Payment_Group_Rule_vod__c": null,
"List_Amount_vod__c": "3000000.0",
"Payment_Group_vod__c": null,
"Delivery_Quantity_vod__c": null,
"Payment_Brand_vod__c": "Brand1",
"Free_Goods_vod__c": "10.0",
"Group_Discount_Rule_vod__c": null,
"Brand_Discount_Rule_vod__c": null,
"Net_Price_vod__c": "90000.0",
"Line_Warning_vod__c": null,
"Discount_Calculation_Path_vod__c": null,
"Total_Payment_Rule_vod__c": "Brand1",
"Net_Price_Rule_vod__c": "90000.0",
"Product_Group_vod__c": null,
"Payment_Brand_Rule_vod__c": "Brand1",
"Line_Discount_vod__c": "10.000002",
"Net_Amount_vod__c": "2700000.0",
"Net_Amount_Rule_vod__c": "2700000.0",
"Order_Discount_vod__c": null
}
}
},
"Order_Lines_vod__r": [
{
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "30",
"Net_Price_vod__c": "100000.0",
"Free_Goods_vod__c": "10.0",
"AvailableLinePayments": [],
"AvailableBrandPayments": [
"Brand1",
"Brand2"
],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000J4sVoIAJ",
"Name": "Order Product Order",
"Product_Identifier_vod__c": "UserDefined",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"Description_vod__c": "Second",
"BrandId": "a00Z000000HkfDkIAJ",
"GroupIds": [],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [
{
"Message": "Need total between 1 and 20",
"Error": true
}
],
"FieldErrors": [],
"Suggestions": [],
"CalculatedFields": {
"Final_Net_Price_vod__c": "90000.0",
"Line_Discount_Rule_vod__c": "10.000002",
"Payment_vod__c": null,
"Final_Net_Price_Rule_vod__c": "90000.0",
"Total_Payment_vod__c": "Brand1",
"Free_Goods_Rule_vod__c": "10.0",
"U_M_vod__c": null,
"Brand_Warning_vod__c": null,
"Group_Warning_vod__c": null,
"Total_Discount_Rule_vod__c": "10.000002",
"Rule_vod__c": "Qty > 0, 10 FG;",
"Order_Discount_Rule_vod__c": null,
"Total_Discount_vod__c": "10.000002",
"Payment_Rule_vod__c": null,
"List_Price_Rule_vod__c": "100000.0",
"Payment_Group_Rule_vod__c": null,
"List_Amount_vod__c": "3000000.0",
"Payment_Group_vod__c": null,
"Delivery_Quantity_vod__c": null,
"Payment_Brand_vod__c": "Brand1",
"Free_Goods_vod__c": "10.0",
"Group_Discount_Rule_vod__c": null,
"Brand_Discount_Rule_vod__c": null,
"Net_Price_vod__c": "90000.0",
"Line_Warning_vod__c": null,
"Discount_Calculation_Path_vod__c": null,
"Total_Payment_Rule_vod__c": "Brand1",
"Net_Price_Rule_vod__c": "90000.0",
"Product_Group_vod__c": null,
"Payment_Brand_Rule_vod__c": "Brand1",
"Line_Discount_vod__c": "10.000002",
"Net_Amount_vod__c": "2700000.0",
"Net_Amount_Rule_vod__c": "2700000.0",
"Order_Discount_vod__c": null
}
}
]
}
}
Example: Pricing Request with Overrides
This request details how to Override calculated fields that are set by the Pricing Engine. To Override calculated fields, the Client must include the field name in Overridden_Fields
, with the field name pointing to a boolean value.
Request
{
"type": "Order_vod__c",
"Notes_vod__c": "Saving Order",
"Account_vod__c": "001Z000000avoIH",
"Order_Date_vod__c": "08/25/2015",
"Order_Lines_vod__r": [
{
"type": "Order_Line_vod__c",
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "15",
"Free_Goods_vod__c": "3",
"Overridden_Fields": [
{
"Free_Goods_vod__c": "true"
}
]
}
]
}
Response
{
"status": 0,
"message": "",
"data": {
"Order_List_Amount_vod__c": "1500000.0",
"Payment_vod__c": "25",
"Payment_Rule_vod__c": "25",
"Order_Net_Amount_vod__c": "1500000.0",
"Order_Total_Quantity_vod__c": "15.0",
"Order_Total_Discount_vod__c": "0.00",
"Order_Lines_vod__r": [
{
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "15",
"Line_Discount_vod__c": "0.0",
"Net_Price_vod__c": "100000.0",
"Free_Goods_vod__c": "3",
"AvailableLinePayments": [],
"AvailableBrandPayments": [
"Brand1",
"Brand2"
],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00Z000000J4sVoIAJ",
"Name": "Order Product Order",
"Product_Identifier_vod__c": "UserDefined",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"Description_vod__c": "Second",
"BrandId": "a00Z000000HkfDkIAJ",
"GroupIds": [],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [
"Suggestion range: 10-20"
],
"CalculatedFields": {
"Final_Net_Price_vod__c": "100000.0",
"Line_Discount_Rule_vod__c": "0.0",
"Payment_vod__c": null,
"Final_Net_Price_Rule_vod__c": "100000.0",
"Total_Payment_vod__c": "25",
"Free_Goods_Rule_vod__c": "10.0",
"U_M_vod__c": null,
"Brand_Warning_vod__c": null,
"Group_Warning_vod__c": null,
"Total_Discount_Rule_vod__c": "0.0",
"Rule_vod__c": "Qty > 0, 10 FG;;",
"Order_Discount_Rule_vod__c": null,
"Total_Discount_vod__c": "0.0",
"Payment_Rule_vod__c": null,
"List_Price_Rule_vod__c": "100000.0",
"Payment_Group_Rule_vod__c": null,
"List_Amount_vod__c": "1500000.0",
"Payment_Group_vod__c": null,
"Delivery_Quantity_vod__c": null,
"Payment_Brand_vod__c": "Brand1",
"Group_Discount_Rule_vod__c": null,
"Brand_Discount_Rule_vod__c": null,
"Net_Price_vod__c": "90000.0",
"Line_Warning_vod__c": null,
"Discount_Calculation_Path_vod__c": null,
"Total_Payment_Rule_vod__c": "25",
"Net_Price_Rule_vod__c": "90000.0",
"Product_Group_vod__c": null,
"Payment_Brand_Rule_vod__c": "Brand1",
"Line_Discount_vod__c": null,
"Net_Amount_vod__c": "1500000.0",
"Net_Amount_Rule_vod__c": "1500000.0",
"Order_Discount_vod__c": null
}
}
]
}
}
Example: Pricing Request with Auto-Added Lines
This request details how to work with auto-added lines. Order Lines can be auto-added when a cross product rule is triggered. All auto-added lines will show up under AddedLines in the response. If Order Lines are auto-added, the API treats this as a validation error (even if the save flag is set to true) since user input is required. If the user decides to remove the auto-added line, the Client must mark the line as Deleted and include it in the payload.
{
"type":"Order_Line_vod__c",
"Product_vod__c":"a00U000000CqXqmIAF",
"Deleted": "true"
}
Request
{
"type":"Order_vod__c",
"Account_vod__c":"001U000000vlPokIAE",
"Order_Lines_vod__r":[
{
"type":"Order_Line_vod__c",
"Product_vod__c":"a00U000000CqXqFIAV",
"Quantity_vod__c":"600"
}
],
"RecordTypeId":"012U0000000V6izIAC",
"Contract_vod__c":"a21U0000001iobDIAQ"
}
Response
{
"status": -4,
"message": "Review all error messages below to correct your data.",
"data": {
"Order_List_Amount_vod__c": "30600.00",
"Payment_vod__c": "T.Order_P.T._NetAmount with OM Bound Contract",
"Payment_Rule_vod__c": "T.Order_P.T._NetAmount with OM Bound Contract",
"Order_Discount_vod__c": "3.00",
"Order_Net_Amount_vod__c": "29682.00",
"Order_Total_Quantity_vod__c": "600",
"Order_Total_Discount_vod__c": "3.00",
"AddedLines": {
"a00U000000CqXqmIAF": {
"Product_vod__c": "a00U000000CqXqmIAF",
"AvailableLinePayments": [],
"AvailableBrandPayments": [],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00U000000CqXqmIAF",
"Name": "Product_H6",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"BrandId": "a00U000000CqXspIAF",
"GroupIds": [
"a00U000000CqXtEIAV"
],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [
"Order $50001-60000 Products in total order with OM Bound Contract triggers PaymentTermsPRs_T.Order_NetAmount"
],
"CalculatedFields": {
"Rule_vod__c": "TotalOrder(qty 500-1000) to get 1 FG1 for H6;Order $30000-50000 Products in total order with OM Bound Contract triggers PaymentTermsPRs_T.Order_NetAmount",
"Free_Goods_vod__c": "1",
"Total_Discount_Rule_vod__c": "0.00",
"Total_Discount_vod__c": "0.00",
"Line_Discount_vod__c": "0.00",
"Net_Price_vod__c": "26.00",
"Total_Payment_vod__c": "T.Order_P.T._NetAmount with OM Bound Contract",
"Free_Goods_Rule_vod__c": "1",
"List_Price_Rule_vod__c": "26.00"
}
}
},
"Order_Lines_vod__r": [
{
"Product_vod__c": "a00U000000CqXqFIAV",
"Quantity_vod__c": "600",
"AvailableLinePayments": [],
"AvailableBrandPayments": [
"P.T. Brand_F_NetAmount with OM Bound Contract_(1)",
"P.T. Brand_F_NetAmount with OM Bound Contract_(2)"
],
"AvailableGroupPayments": [
"P.T. P.G._3_NetAmount with OM Bound Contract_(1)",
"P.T. P.G._3_NetAmount with OM Bound Contract_(2)"
],
"Product_vod__r": {
"Id": "a00U000000CqXqFIAV",
"Name": "Product_F1",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"BrandId": "a00U000000CqXsnIAF",
"GroupIds": [
"a00U000000CqXtCIAV"
],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [
{
"Message": "Can only order $0-$5000 (Net Amount) Brand_F products with OM Bound Contract",
"Error": false
}
],
"FieldErrors": [],
"Suggestions": [
"Order $50001-60000 Products in total order with OM Bound Contract triggers PaymentTermsPRs_T.Order_NetAmount"
],
"CalculatedFields": {
"Final_Net_Price_vod__c": "49.47",
"Final_Net_Price_Rule_vod__c": "49.47",
"Net_Price_vod__c": "51.00",
"Total_Payment_vod__c": "T.Order_P.T._NetAmount with OM Bound Contract",
"Rule_vod__c": "Order 500+ products in total order with OM Bound Contract get 3% off;Order $30000-50000 Products in total order with OM Bound Contract triggers PaymentTermsPRs_T.Order_NetAmount",
"Total_Discount_Rule_vod__c": "3.00",
"Order_Discount_Rule_vod__c": "3.00",
"Line_Discount_vod__c": "0.00",
"Total_Discount_vod__c": "3.00",
"Net_Amount_vod__c": "29682.00",
"Net_Amount_Rule_vod__c": "29682.00",
"Order_Discount_vod__c": "3.00",
"List_Price_Rule_vod__c": "51.00",
"List_Amount_vod__c": "30600.00"
}
},
{
"Product_vod__c": "a00U000000CqXqmIAF",
"AvailableLinePayments": [],
"AvailableBrandPayments": [],
"AvailableGroupPayments": [],
"Product_vod__r": {
"Id": "a00U000000CqXqmIAF",
"Name": "Product_H6",
"Product_Type_vod__c": "Order",
"Pricing_Bound_vod__c": false,
"BrandId": "a00U000000CqXspIAF",
"GroupIds": [
"a00U000000CqXtEIAV"
],
"KitParent": false,
"InitialQuantityLimitBound": false
},
"PricingErrorsAndWarnings": [],
"FieldErrors": [],
"Suggestions": [
"Order $50001-60000 Products in total order with OM Bound Contract triggers PaymentTermsPRs_T.Order_NetAmount"
],
"CalculatedFields": {
"Rule_vod__c": "TotalOrder(qty 500-1000) to get 1 FG1 for H6;Order $30000-50000 Products in total order with OM Bound Contract triggers PaymentTermsPRs_T.Order_NetAmount",
"Free_Goods_vod__c": "1",
"Total_Discount_Rule_vod__c": "0.00",
"Total_Discount_vod__c": "0.00",
"Line_Discount_vod__c": "0.00",
"Net_Price_vod__c": "26.00",
"Total_Payment_vod__c": "T.Order_P.T._NetAmount with OM Bound Contract",
"Free_Goods_Rule_vod__c": "1",
"List_Price_Rule_vod__c": "26.00"
}
}
]
}
}
Editing an Existing Order
To edit an existing Order make an HTTP PUT
request to the following endpoint:
PUT: {base-URL}/orders/{orderId}
Actions
Endpoint to price or save an Existing Order to Veeva CRM. When editing/saving, the Order is automatically validated based on the Pricing Rules defined for the User and Organization.
Parameters
The following parameters are optional:
save
- Include this flag as a query parameter to save the Order to Veeva CRM. No value is required. If not included, then the Order will not be saved. This can be used to price.
Payload
The following fields must be present in the payload (data) sent to the server:
type
:Order_vod__c
type
:Order_Line_vod__c
(for Order Lines)
Note: Date fields need to be sent in the user’s local format. An appropriate error will be returned if this specification is not met.
Example: Valid Edit
Request
{
"type": "Order_vod__c",
"Notes_vod__c": "Editing Order",
"Order_Lines_vod__r": [
{
"type": "Order_Line_vod__c",
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "15"
}
]
}
Response
{
"status": 0,
"message": "'1' record(s) updated",
"data": {
"Id": "a1HZ0000001D139MAC"
}
}
This request details how to edit an existing Order and then save it to Veeva CRM. The response returned contains a record update message, along with the Id of the updated Order.
Example: Edit to Clear Field Values
This request details how to delete (clear) field values for an existing Order, and then save it to Veeva CRM. To delete (clear) field values, the field value in the payload must be set to null
.
Request
{
"type": "Order_vod__c",
"Notes_vod__c": null,
"Order_Lines_vod__r": [
{
"type": "Order_Line_vod__c",
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Quantity_vod__c": "15"
}
]
}
Response
{
"status": 0,
"message": "'1' record(s) updated",
"data": {
"Id": "a1HZ0000001D139MAC"
}
}
Example: Edit to Delete Order Lines
This request details how to delete existing Order Lines for an Order, and then save it to Veeva CRM. To delete existing Order Lines, include the Deleted field in the Order Line, with the field name pointing to a boolean value.
Request
{
"type": "Order_vod__c",
"Notes_vod__c": null,
"Order_Lines_vod__r": [
{
"type": "Order_Line_vod__c",
"Product_vod__c": "a00Z000000J4sVoIAJ",
"Deleted": "true"
}
]
}
Response
{
"status": 0,
"message": "'1' record(s) updated",
"data": {
"Id": "a1HZ0000001D139MAC"
}
}
Example: Pricing Requests
These should be identical to the Pricing Requests in Save Order. Use PUT
with the orderId
instead of POST
.
Using External Id References when Creating/Editing Orders
Analogous to the Salesforce.com UPSERT call, the OM API supports the use of External Ids when crating or editing Orders both for the Order itself and for related data.
Creating a New Order using an External Id for Account and Product
To create a New Order make an HTTP ‘POST’ request to the following endpoint:
POST: {base-URL}/orders/{orderId}
For Id-type fields in the request parameters, use the following syntax to reference an External Id field:
[OBJECT RELATIONSHIP NOTATION]
:
{
[EXTERNAL ID FIELD NAME]:
[EXTERNAL ID VALUE]}
Request
{
"type": "Order_vod__c",
"Notes_vod__c": null,
"Account_vod__r": {"External_ID_vod__c":"Bob_Adams_Account"}
}
"Order_Lines_vod__r": [
{
"type": "Order_Line_vod__c",
"Product_vod__r" : {"External_ID_vod__c":"Product_A"},
"Deleted": "true"
}
]
}
Response
{
"status": 0,
"message": "'1' record(s) updated",
"data": {
"Id": "a1HZ0000001D139MAC"
}
}
Interactions
The API provides the following interactions:
Creating an Order
- Perform a
GET
on resource accounts to get the list of eligible Accounts that can create Orders. - Perform a
GET
on resource{base-URL}/orders?accountId={accountId}
. The will return information like default Addresses, Campaigns, Contracts and all the available Order Lines. - Optional: Perform a
POST
on resource{base-URL}/orders
to validate the Order data. Repeat this until the data is valid and acceptable by the Pricing Engine. - Perform a
POST
on resource{base-URL}/orders?save
withsave
flag included. The data will automatically be validated and an appropriate response will be returned.
Editing an Order
- Perform a
GET
on resource{base-URL}/orders/{orderId}?mode=review
. This will return all the necessary Order fields along with all the available Order Lines. - Optional: Perform a
PUT
on resource{base-URL}/orders/{orderId}
to validate the Order data. Repeat this until the data is valid and acceptable by the Pricing Engine. - Perform a
PUT
on resource{base-URL}/orders/{orderId}?save
withsave
flag included. The data will automatically be validated and an appropriate response will be returned.
Viewing an Order
- To view an existing Order, perform a
GET
on resource{base-URL}/orders/{orderId}
. This will return all the relevant Order Header and Order Line fields with formatted values.
Retrieving Order Status
- Perform a
GET
on{base-URL}/orders/{orderId}/status
. This will return the current Order status, as well as the next possible status for the Order.
Submitting an Order
Perform a PUT
on resource {base-URL}/orders/{orderId}/status
with Status_vod__c
set to Submitted_vod
in the payload.
Voiding an Order
Perform a PUT
on resource {base-URL}/orders/{orderId}/status
with Status_vod__c
set to Voided_vod
in the payload.
Unlocking an Order
Perform a PUT
on resource {base-URL}/orders/{orderId}/status
with Status_vod__c
set to Saved_vod
in the payload.
Deleting an Order
Perform a DELETE
on resource {base-URL}/orders/{orderId}
. This will delete the Order if the user has the necessary delete permissions.
Supported Features
Veeva Order Management supports the following features through API:
- Best Pricing Logic
- Billing and Delivery (Shipping) Addresses
- Cross-Product Limit Rules
- Cross-Product Rebate Rules
- Custom Fields on Order Lines
- Custom Sort of Products
- Disable Rebate Mixing
- Edit Order
- Final Net Price
- Fixed and Non-Fixed Product Kits
- Linear- vs. Price-additive Discount Calculation
- Order Campaigns
- Order Header Pull-in Fields
- Order Round Methods
- Order Soft Delete
- Order Types Support
- Payment Terms (Veeva settings)
- Pricing Rules Engine (Disc, Limit, List Price, Payment Rules, FG)
- Pricing-Bound Kit Items
- Product Identifier
- Sales Contracts
- Select Account Partner on Order
- Upsell Text