Solved

CustSalesPeople.IsDefault vs POVendorInventory.IsDefault

  • 16 November 2021
  • 4 replies
  • 220 views

Userlevel 6
Badge +1

I’ve got what seems to be an obscure technical question, but read all the way to the end to see why it matters.

 

If I build a Generic Inquiry on the CustSalesPeople table, the IsDefault field appears in the SQL Trace results, showing that this value is pulled from the database. See these two screenshots:

 

But if I build a Generic Inquiry on the POVendorInventory table, the IsDefault field does not appear in the SQL Trace results. Somehow it must get magically pulled from the Acumatica Framework somehow. See these two screenshots:

 

Now for why this matters.

 

I’m able to use CustSalesPeople.IsDefault in a CONDITION or a JOIN, but I’m not able to use POVendorInventory.IsDefault in a CONDITION or a JOIN.

 

Sometimes I need to get the “default Salesperson for a Customer” so I join from Customer to CustSalesPeople and include CustSalesPeople.IsDefault=true in the join. This works great.

 

But what if I need to get the “default Vendor for an Item”? I’m not able to do that because I can’t join from InventoryItem to POVendorInventory and include POVendorInventory.IsDefault in the join.

 

I would use the InventoryItem.PreferredVendorID field for this. It works. But, as you can see in this next screenshot, it’s marked as OBSOLETE in the new DAC Schema Browser which makes me wonder if it will be removed in future Acumatica versions:

 

Can someone help me understand how to get the default Vendor for an Item?

Maybe @Vladimir Perov knows the answer on this? I would have tagged Vladimir Panchenko, but I can’t find him in the list of names :slight_smile:

icon

Best answer by Gabriel Michaud 16 November 2021, 21:51

View original

4 replies

Userlevel 7
Badge +10

Hi Tim,

You’ve done a fair bit of research as far as I can see!

The POVendorInventory.IsDefault field is not a database field; its value is set by an attribute called PODefaultVendor. As you have figured out this means that you cannot use this field in relations.

Internally, the PODefaultVendor attribute looks at the PreferredVendorID and PreferredVendorLocationID fields to determine if the default checkbox should be checked.

 

I checked internally why the field is marked as obsolete and found the answer by looking at the Data Access class: “This field is obsolete and is going to be removed in 2022R1. Use InventoryItemCurySettings.PreferredVendorID instead” (isn’t there a way from the schema browser to see these notes?!?)

 

My understanding is that it is now possible to set a default vendor by currency, along with all the other default attributes. This is most likely related to the support of multiple base currencies in the same tenant that is currently being rolled out.

Solution: just add a relationship to the InventoryItemCurySettings table, filtering on your base currency in case you have multiple ones, and use the PreferredVendorID field form there 😊

 

Userlevel 6
Badge +1

Ah, beautiful!!! Yes, this makes complete sense! I’ll keep my eye out for other places like this where the new support of multiple base currencies will have an impact.

And thanks for the screenshot. Maybe those notes will make their way into the DAC Schema Browser in future versions.

Userlevel 3
Badge

Couldn’t agree more on putting these notes in the DAC Schema browser.  It would have saved me hours of digging/trial&error and a wasted case w Acumatica that went nowhere.  I never would have found it if Tim had not asked and Gabriel not responded.  Much appreciated to both!

Thank you! I was also confused as to why it was there… but not there… :D 

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