Skip to main content

Posts

Showing posts with the label Control Documents

Fetching Company Details in X++

In D365FO, retrieving legal entity details like logos, addresses, and tax IDs is a common requirement for reports and custom documents. The  CompanyInfo table is your primary source for this data. Instead of writing complex joins, use these built-in methods to fetch data for the current company context: CompanyInfo companyInfo = CompanyInfo::find(); // Populate your table or variables tmp.CompanyLogo = FormLetter::companyLogo(); tmp.CompanyName = companyInfo.Name; tmp.CompanyAddress = companyInfo.postalAddress().Address; tmp.Telephone = companyInfo.phone(); tmp.Fax = companyInfo.teleFax(); tmp.Giro = companyInfo.Giro; tmp.TaxRegistrationNumber = companyInfo.CoRegNum; Why this works: CompanyInfo::find() : Automatically fetches the record for your current legal entity. FormLetter::companyLogo() : The standard way to grab the company logo for documents. Helper Methods : Methods like .phone() and .postalAddress() save you f...