Skip to main content
X++ Development · · 1 min read

Get Store Name from Store Number

 Retrieve the store name from a store number using X++ in D365 Finance and Operations. 

A

Ahmad Hassan

Dynamics 365 F&O Consultant

Share
Get Store Name from Store Number

This X++ method retrieves the operating unit name associated with a specified retail store number.
It joins RetailStoreTable with RetailChannelTable and OMOperatingUnit to identify the related operating unit.
The method returns the corresponding OMOperatingUnit.Name for the provided store number.

X++ Code

public static RetailStoreId  getStoreName(RetailStoreId _storeNo) //RetailStoreId

{

    RetailChannelTable  retailChannelTable;

    RetailStoreTable    retailStoreTable;

    OMOperatingUnit     oMOperatingUnit;

    select RecId, StoreNumber from retailStoreTable

        join  RecId, OMOperatingUnitID from retailChannelTable

        where retailChannelTable.RecId == retailStoreTable.RecId

        join RecId, Name from oMOperatingUnit

        where retailChannelTable.OMOperatingUnitID ==  oMOperatingUnit.RecId

           && retailStoreTable.StoreNumber         == _storeNo;

    return oMOperatingUnit.Name;

}

Process Flow

The method receives a retail store number through _storeNo and searches the corresponding RetailStoreTable record.

It joins the store with RetailChannelTable using the related RecId.

The channel is then joined with OMOperatingUnit through OMOperatingUnitID.

Finally, the method returns the matching operating unit Name.

e0667023-473d-4bff-b225-b61dc90e4880.png

Figure: Flow of retrieving the operating unit name for a retail store.

Found this useful?

Share it with your network

A

Written by

Ahmad Hassan

Microsoft Dynamics 365 Finance & Operation, Technical Consultant

More about me

Related Posts

Comments

Leave a comment