Hi,
Each of our released products have a financial dimension (Business Unit). We have multiple business units under one entity. Released products cannot be shared across business dimensions. In the below code snipped I am looping through released products then looking up the product's financial dimension. If found, and the product dimensions is the same as the customer financial dimension, break the while loop. If there a better way to do this query?
var cust = CustTable::find(account); var custBusinessDim = WSTG_Helpers::GetDimensionDisplayValue(cust.DefaultDimension, "BusinessUnit"); InventTable inventTable; MCRInventTable mInventTable; while select inventTable where inventTable.WSTG_MFGPartNo == productId join mInventTable where mInventTable.InventTable == inventTable.RecId { // lookup the dimension value var productDim = WSTG_Helpers::GetDimensionDisplayValue(inventTable.DefaultDimension,"BusinessUnit"); if(productDim == custBusinessDim) { break; } }
public static str GetDimensionDisplayValue(RecId defaultDimension, Name dimName) { DimensionAttributeValueSetStorage dimStorage; dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension); return dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(dimName).RecId); }
Hi André, sorry for the delay.
"Do you have setup the Business units also as separate legal entities, or is there one legal entity with multiple business units?" - there one legal entity with multiple business units
"At least, what I understand is that if customer A from company A is ordering Z98765, then the order should use item ID 12345-A. For Customer B and company B, the item number for the same part number is SKU888." - No we have a customer field call MFGPN (Manufacture Part number) on the Release Products.
"Both the customer and the item do have the Business unit dimension in common?" Yes.
Hi Philly,
Thanks for the reply. It makes the scenario a bit clear. Do you have setup the Business units also as separate legal entities, or is there one legal entity with multiple business units?
At least, what I understand is that if customer A from company A is ordering Z98765, then the order should use item ID 12345-A. For Customer B and company B, the item number for the same part number is SKU888.
Both the customer and the item do have the Business unit dimension in common?
Hi,
I will try my best to explain. In deed my example code I provided is terribly inefficient! I recognize this :).
We have 2 companies that report up to the parent entity. These 2 companies I will call CompA and CompB. They are completely separate companies and cannot share a customer number or released products.
A customer is assigned a financial dimension aka 'Business Unit'. For this example CompA and CompB. When a released product is created, its assigned a financial dimensions 'Business Unit', CompA or CompB.
A customer for CompA, cannot purchase a released product in CompB and visa versa.
The released product has a custom field called 'WSTG_MFGPartNo'. This is the manufactures part number. Normally this value is on the external item description and based on the vendor we are purchasing from, however we are a distribution business and the manufacture part number is on the release product. (I didn't set it up this way, this is what I inherited)
An example would be:
Product Id: 12345-A, for CompA MFGPN Z98765
Product Id: SKU888, for CompB MFGPN Z98765
Orders come in through EDI via Api ODATA from a 3rd party. The 3rd party only knows the manufacture's part number. They need to know which product to add to the sales order. So it's possible without this lookup that the wrong item can be added to the sales order.
I hope I explained this correctly. It's actually a lot more complicated because there are several companies under several entities.
Hi Philly,
Can you tell the business requirement with a functional description? Is there some business logic to be actually added in or after the loop? Just looping some records and abort it with a break command doesn't make sense to me. So, I do assume you have to add statements or did hide them for this question.
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156