Solved

How to get sales price from API - customer specific including fallback

  • 11 January 2023
  • 5 replies
  • 254 views

Userlevel 1

HI,

I’m wondering how I can use the Acumatica Apis to retrieve the price for an item based on the inventoryID and the CustomerID

I’ve found the /entity/Default/20.200.001/SalesPricesInquiry API - I can use this to get the base price and the customer specific price.

From what I understand in the Acumatica ERP there is a hierarchy for the price as follows 

Customer Specific
Customer Price Class
and then finally Base price

So it appears that I could figure out the price for an item by making an inquiry for each of those steps and using the first one that returns a price?

I feel that this is not a great solution though because this is getting into the details of the business logic of Acumatica. Is there a way to send the information for the Customer and Inventory ID to the API and just get the price?

icon

Best answer by jinin 24 January 2023, 19:17

View original

5 replies

Userlevel 7
Badge +11

Hi @aaldrich,

Please try like below,

Url : /entity/Default/20.200.001/SalesPricesInquiry?$expand=SalesPriceDetails

Method: PUT
Request:

{

    "InventoryID": {

        "value": "AACOMPUT01"

    },

     "PriceType": {

        "value": "CUSTOMER"

    }

}

Response:
 

{
"id": "e35d1034-60b1-4814-9f18-373ea1acd823",
"rowNumber": 1,
"note": null,
"EffectiveAsOf": {
"value": "2023-01-11T00:00:00+05:30"
},
"InventoryID": {
"value": "AACOMPUT01"
},
"ItemClassID": {},
"PriceClass": {},
"PriceCode": {},
"PriceManager": {},
"PriceManagerIsMe": {
"value": false
},
"PriceType": {
"value": "Customer"
},
"PriceWorkgroup": {},
"PriceWorkgroupIsMine": {
"value": false
},
"SalesPriceDetails": [
{
"id": "d35fa333-83f3-4ca5-b6c2-2b81e0ff4198",
"rowNumber": 1,
"note": {
"value": ""
},
"BreakQty": {
"value": 3.0000
},
"CreatedDateTime": {
"value": "2015-05-01T08:36:13.557+05:30"
},
"CurrencyID": {
"value": "USD"
},
"Description": {
"value": "Acer Laptop Computer"
},
"EffectiveDate": {
"value": "2015-05-01T00:00:00+05:30"
},
"ExpirationDate": {},
"InventoryID": {
"value": "AACOMPUT01"
},
"LastModifiedDateTime": {
"value": "2015-05-01T08:37:06.953+05:30"
},
"Price": {
"value": 475.000000
},
"PriceCode": {
"value": "ABARTENDE"
},
"PriceType": {
"value": "Customer"
},
"Promotion": {
"value": false
},
"RecordID": {
"value": 4756
},
"Tax": {},
"UOM": {
"value": "EA"
},
"custom": {}
},
{
"id": "d316b8b9-e7c3-ea11-8176-d002f6e7f394",
"rowNumber": 2,
"note": {
"value": ""
},
"BreakQty": {
"value": 3.0000
},
"CreatedDateTime": {
"value": "2020-07-11T19:31:33.497+05:30"
},
"CurrencyID": {
"value": "USD"
},
"Description": {
"value": "Acer Laptop Computer"
},
"EffectiveDate": {
"value": "2020-07-11T00:00:00+05:30"
},
"ExpirationDate": {},
"InventoryID": {
"value": "AACOMPUT01"
},
"LastModifiedDateTime": {
"value": "2020-07-11T19:31:33.497+05:30"
},
"Price": {
"value": 475.000000
},
"PriceCode": {
"value": "AACUSTOMER"
},
"PriceType": {
"value": "Customer"
},
"Promotion": {
"value": false
},
"RecordID": {
"value": 4876
},
"Tax": {},
"UOM": {
"value": "EA"
},
"custom": {}
}
],
"custom": {}
}

 

Userlevel 1

@ jinin

I’ve tried your solution but it doesn’t seem to also include the base price for the items. Am I missing something here?

 

For example, if I’m looking at this item for Customer “PRECISION” i would expect to see 500 because it is the base price for that item.

Userlevel 7
Badge +11

@ jinin

I’ve tried your solution but it doesn’t seem to also include the base price for the items. Am I missing something here?

 

For example, if I’m looking at this item for Customer “PRECISION” i would expect to see 500 because it is the base price for that item.

Hi @aaldrich ,

 

The base price type will load based on the inventory. Customer type will load records based on the customer. Customer price class loads the records based on the warehouse.

 



In your case, we will not fetch data based on the Customer with Base price type.

try like the below to get the data based on the customer and customer Price type 

url - /TEST/20.200.001/SalesPricesInquiry?$expand=SalesPriceDetails&$filter=PriceCode eq 'ABARTENDE'


request:

{
"InventoryID": {
"value": "AACOMPUT01"
},
"PriceType": {
"value": "Customer"
}
}



 

Userlevel 1

@ jinin

Hey Jini, thanks for your reply. From what your are saying I think I understand that with this query I can get all the customer specific prices from this api by using the PriceType of Customer.

This is helpful but it doesn’t quite get what I need. Let me try to clarify what I’m looking for.

 

The end goal is to have a function where I have the following inputs InventoryID, CustomerID, and WarehouseID (potentially Customer Price Class if need be) then the output will be a single price.

 

For the InventoryID AACOMPUT01

 

CASE CustomerID Price
1 ABARTENDE 475.00
2 AACUSTOMER 475.00
3 PRECISION 500.00 (because it is the Base Price for this item)
4 ABCVENTURE 500.00
5 A customer that has a price class of WHOLESALE 475.00 (price break of 450.00 after 3)

 

So in your example I can see that I can easily get Cases 1 and 2 but how do I get case 3, 4, and 5?

Essentially, the problem alluded to in the original message is that the SalesPricesInquiry API gives back multiple prices for an item (and I’m not just talking different price breaks as that is not the problem) but how do I know which one to use? All I know is the InventoryID, CustomerId, and WarehouseID (potentially the Customer Price Class if need be) so how do I get the actual price of the item for those inputs?

 

Appreciate the help,

Andrew

 

P.S. If I’m just confused with how the pricing works in Acumatica or my assumptions about the prices in the table above are incorrect, I’d appreciate if I can understand more.

Userlevel 7
Badge +11

Hi @aaldrich ,

Am not sure we can fetch the data based on the customer, Warehouse, and InventoryID filter at a time.

The base price type will load data based on the inventory. Customer type will load data based on the customer. Customer price class loads the data based on the warehouse.
 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved