Get Store Name from Store Number
Retrieve the store name from a store number using X++ in D365 Finance and Operations.
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.

Figure: Flow of retrieving the operating unit name for a retail store.
Found this useful?
Share it with your network
Written by
Ahmad Hassan
Microsoft Dynamics 365 Finance & Operation, Technical Consultant
More about meRelated Posts
Get Customer Account from Journal ID
Retrieve the customer account from a journal ID using X++ in D365 Finance and Operations.
Get Customer Invoice Address Street
Retrieve the customer invoice address street using X++ in D365 Finance and Operations for accurate invoice address data processing.
Retrieve Vendor Name, Alias, Email, Phone and Speciality
Retrieve vendor name, alias, email, phone, and speciality details using X++ in D365 Finance and Operations.