web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Select released products based on item id and financial dimension

(0) ShareShare
ReportReport
Posted on by 81

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);
    }

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    299,314 Super User 2025 Season 2 on at
    RE: Select released products based on item id and financial dimension

    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.

  • PhillyNJ Profile Picture
    81 on at
    RE: Select released products based on item id and financial dimension

    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.

  • André Arnaud de Calavon Profile Picture
    299,314 Super User 2025 Season 2 on at
    RE: Select released products based on item id and financial dimension

    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?

  • PhillyNJ Profile Picture
    81 on at
    RE: Select released products based on item id and financial dimension

    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.

    6064.bu2.png

    "Both the customer and the item do have the Business unit dimension in common?" Yes.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,122

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 918 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 646 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans