Posts

Showing posts from September, 2025

TableId by given table name.

Image
In Dynamics 365 Finance & Operations, we get table id by using tableNum() method and on sql we get by using the system table  SYSTABLEIDVIEW   SYSTABLEIDVIEW is used to look up the mapping between a table name and its Table ID. select * from SYSTABLEIDVIEW where Name = 'hcmworker' 👉 What it does: Looks up the table hcmworker. Returns metadata, including: TableID → the unique integer ID assigned to hcmworker . Name → table name. Possibly additional system columns depending on SQL setup. ✅ Example output: Table id by using x++: int tableId = tableNum(hcmWorker); str tableName = tableId2Name(tableId);

How to use logged in company data into code

As a Dynamics 365 Finance & Operations (D365FO) Technical Consultant , one of the common requirements is to fetch details of the current legal entity (company) . Here’s a small but powerful X++ line that helps us: CompanyInfo companyInfo = CompanyInfo::findRecId(CompanyInfo::current()); 👉 CompanyInfo A standard table in D365FO. Stores company-specific details like Name, Address, Currency, Tax info, Contact details etc. 👉 CompanyInfo::current() Returns the RecId of the company you are currently logged into. Example: If you are in USMF, it gives the RecId of USMF. 👉 CompanyInfo::findRecId(...) Finds and returns the full CompanyInfo record for the given RecId. ✅ Together, they give you all the details of the logged-in company. Example: CompanyInfo companyInfo = CompanyInfo::findRecId(CompanyInfo::current()); info(strFmt("You are logged into company: %1", companyInfo.Name)); info(strFmt("Default currency: %1", companyInfo.CurrencyCode)); 🌟 Why is this useful? N...

Generate error on empty Financial Dimensions in D365FO

When working with Human Resources and Finance integration in Dynamics 365 Finance and Operations (D365FO), ensuring financial dimensions are properly defined on employee records is critical for accurate reporting and budgeting. In this blog, we'll look at how to enforce required dimensions using a validatedWrite event handler on the HcmEmployment table. We'll use an event handler on the HcmEmployment table's validatedWrite method to check for the presence of specific dimensions on the DefaultDimension field. [DataEventHandler(tableStr(HcmEmployment), DataEventType::ValidatedWrite)]     public static void HcmEmployment_onValidatedWrite(Common sender, DataEventArgs e)     {         HcmEmployment HcmEmployment = sender as HcmEmployment;           DimensionAttributeValueSetStorage dimAttrValueSetStorage;         DimensionAttribute dimensionAttribute;         // List of required fina...