Author: Mohammed Salah

DMF Metadata sample

<?xml version=”1.0″?> -<edmx:Edmx Version=”4.0″ xmlns:edmx=”http://docs.oasis-open.org/odata/ns/edmx”> -<edmx:DataServices> -<Schema Namespace=”Microsoft.Dynamics.DataEntities” xmlns=”http://docs.oasis-open.org/odata/ns/edm”> -<EntityType Name=”Customer”> -<Key> <PropertyRef Name=”CustId”/> </Key> -<Property Name=”CustId” Nullable=”false” Type=”Edm.Int32″> <Annotation String=”Customer Id” Term=”Microsoft.Dynamics.OData.Core.V1.LabelId”/> -<Annotation Term=”Microsoft.Dynamics.OData.Core.V1.AXType”> <EnumMember>Microsoft.Dynamics.OData.Core.V1.AXType/Int32</EnumMember> </Annotation> </Property> -<Property Name=”LocationName” Type=”Edm.String”> <Annotation String=”Location Name” Term=”Microsoft.Dynamics.OData.Core.V1.LabelId”/> -<Annotation Term=”Microsoft.Dynamics.OData.Core.V1.AXType”> <EnumMember>Microsoft.Dynamics.OData.Core.V1.AXType/String</EnumMember> </Annotation> </Property> -<Property Name=”State” Type=”Edm.String”> <Annotation String=”State” Term=”Microsoft.Dynamics.OData.Core.V1.LabelId”/> -<Annotation Term=”Microsoft.Dynamics.OData.Core.V1.AXType”> <EnumMember>Microsoft.Dynamics.OData.Core.V1.AXType/String</EnumMember> </Annotation> </Property> -<Property Name=”CustGroup” Type=”Edm.String”> <Annotation…

This is sample Code to get opening balance for Ledger Main account in Ax 2012.

LedgerBalanceMainAccountAmounts ledgerBalance; AmountMst opSum; ; ledgerBalance = LedgerBalanceMainAccountAmounts::construct(); ledgerBalance.parmIncludeRegularPeriod(true); ledgerBalance.parmIncludeOpeningPeriod(true); ledgerBalance.parmIncludeClosingPeriod(false); ledgerBalance.parmAccountingDateRange(mkDate(01,01,2000), mkDate(31,12,2017)); ledgerBalance.calculateBalance(MainAccount::findByMainAccountId(‘1123333’)); opSum = ledgerBalance.getAccountingCurrencyBalance(); info(num2str(opSum,10,2,1,1));

AX 2012: Clear the cache

In this post I would like to share the job. The purpose of this job is to clear Local Cache. Every time when I see doubtful behavior, I run this job to make sure that AX is not misbehave. static void RefreshLocalCache(Args _args) { xSession::removeAOC(); SysTreeNode::refreshAll(); SysFlushDictionary::main(null); SysFlushAOD::main(null); SysFlushData::main(null); SysBPCheckAIFDataObject::flushCache(true); SysFlushReportServer::main(null); SysFlushSystemSequence::main(null); xSession::updateAOC(); info(“ok”);

Upload and read CSV files in Dynamics 365 for operations

To quickly reuse the code here it goes class RGReadSample { /// /// Runs the class with the specified arguments. /// /// The specified arguments. public static void main(Args _args) { AsciiStreamIo                                   file; Array                                           fileLines; FileUploadTemporaryStorageResult                fileUpload; fileUpload = File::GetFileFromUser() as FileUploadTemporaryStorageResult; file = AsciiStreamIo::constructForRead(fileUpload.openResult()); if (file) { if (file.status()) { throw error(“@SYS52680”); } file.inFieldDelimiter(‘,’); file.inRecordDelimiter(‘\r\n’);…

How to convert numbers into Arabic numeric in X++?

static TempStr num2ar(real numerals) { #DEFINE.NumDec(2) str    1        digit; str   30        numeralsTxt; str  250        characters; numeralsTxt= num2str(numerals,0,#NumDec,2,0); characters= “”; while (numeralsTxt) { digit  = subStr(numeralsTxt,1,1); numeralsTxt= strDel(numeralsTxt,1,1); switch(digit) { case ‘0’: characters+= ‘.’; break; case ‘1’: characters+= ‘۱’; break; case ‘2’: characters+= ‘۲’; break; case ‘3’: characters+= ‘۳’; break; case ‘4’: characters+= ‘٤’; break; case…

How about running custom X++ scripts without any down time?

In 10.0.25 you can run simple X++ scripts on a production environment without any downtime. This feature lets you run custom X++ scripts without having to go through Dynamics LCS or suspend your system. Therefore, you can correct minor data inconsistencies without causing any disruptive downtime.   Video: https://www.linkedin.com/posts/michael-pontoppidan-a0ab691_xpp-dynamics365fo-axapta-ugcPost-6894353785636888577-lpgJ/ Reference : https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/deployment/run-custom-scripts