Posts

X++ code Date time format in D365FO

         static str getDateTimeStamp()     {                   utcdatetime  systemDateTime   = DateTimeUtil::getSystemDateTime();           utcdatetime  utcDateTimeLocal =DateTimeUtil::newDateTime(                                                                                                     DateTimeUtil::date(systemDateTime),                                                          ...

Computed columns in Views D365FO x++

Here is the computed column example in view which return Yes/No based on if condition /// <summary> /// </summary> /// return Yes if External Customer has attachment else No /// </summary> public static server str computeFileAttached() { str customerRecID; str fileAttached; str result; SysDictTable dictDocuRef = new SysDictTable(tableNum(DocuRef)); customerRecID=SysComputedColumn::returnField(tableStr(TestExtCustomerView), identifierStr(TestExtCustomerTable), fieldStr(TestExtCustomerTable, RecId)); str s = strFmt('SELECT TOP 1 %1 FROM %2 WHERE %2.%3 = %4  AND %2.%5 = %6', dictDocuRef.fieldName(fieldNum(DocuRef, RefRecId), DbBackend::Sql), dictDocuRef.name(DbBackend::Sql), dictDocuRef.fieldName(fieldNum(DocuRef, RefRecId), DbBackend::Sql),customerRecID, dictDocuRef.fieldName(fieldNum(DocuRef,RefTableId),DbBackend::Sql),"9708"); result = strFmt('ISNULL((%1), \'\')', s); return SysComputedColumn::if( SysComputedColumn::returnLiteral(...

Shrink command for AxDB Sql log file to free space in development VM D365FO

Please execute below commands in SQL Server on AxDB. USE AxDB;   GO   ALTER DATABASE AxDB SET RECOVERY SIMPLE;   GO   DBCC SHRINKFILE (N'AxDBCopy1_Log', EMPTYFILE);   GO  

X++ code how to get inner exception or error in AX 2012 D365FO

try{ } catch(Exception::Error)         {             Microsoft.Dynamics.Ax.Xpp.ErrorException ex;             str errorMsg;             ex = new Microsoft.Dynamics.Ax.Xpp.ErrorException();             errorMsg = ex.Message;             throw error(strFmt("%1",errorMsg));         }

upload file to sharepoint in D365FO x++ code

Hello Guys, Here is the code snippet to upload file into sharepoint site using x++ code D365FO.      public void uploadFiletoSharepoint()     {      //upload to sharepoint site         str site = '/Sites/TestSharepointSite';         str folder = 'TestDocumentLibrary/TestFolder';         System.UriBuilder builder = new System.UriBuilder('Test.sharepoint.com');         str host = builder.Host;         str extId = xUserInfo::getCurrentUserExternalId();         str filename = 'Testdata.csv';         SharePointDocumentStorageProvider storageProvider =             new SharePointDocumentStorageProvider(host, site, folder, extId);         storageProvider.ProviderId = DocuStorageProviderType::SharePoint;            ...

x++ code to add hyperlink to a field in D365FO

Here is a way to provide hyperlink for field. 1.Create an Extension class to the form as below. [ExtensionOf(formStr(TestHistory))] public final class  TestHistoryForm_Extension { } 2.Copy onPostRun form eventhandler and write code as below.     [FormEventHandler(formStr(TestHistory), FormEventType::PostRun)]     public static void TestHistory_OnPostRun(xFormRun sender, FormEventArgs e)     {         FormStringControl   formCtrl = sender.design().controlName(formControlStr(TestHistory,TestHistory_Voucher));         formCtrl .registerOverrideMethod(methodStr(FormStringControl, jumpRef), methodStr(TestHistoryForm_Extension, JumpRefId), sender);     } 3.write definition for JumpRefId method public void jumpRefId(FormControl _formControl)     {         MenuFunction    menuFunction;       ...

How to add new Enum value through extension in D365FO

Here is the useful link. https://docs.microsoft.com/en-us/dynamics365/unified-operations/financials/accounts-receivable/location-relationship

Blogs for SSRS Reports Customization in D365FO

Here is the MS recommendation  to customize standard SSRS Report in D365FO. https://blogs.msdn.microsoft.com/dynamicsaxbi/2017/01/02/customizing-app-suite-reports-using-extensions/

x++ code to get derived dimensions in D365FO

 //return derived dimension value  //Input parameter1:Dimension name  //Input parameter2:Derived Dimension name  //Input parameter3:Dimension value     public str derivedDim(str _dimAttrName, str _derivedDimName,str _dimValue)     {               DimensionAttributeValueDerivedDimensions derivedDim;         DimensionAttribute          dimAttribute;         DimensionAttributeValue     dimAttriValue;         str                         derivedDimValue;         dimAttribute = DimensionAttribute::findByName(_dimAttrName);         if(dimAttribute)         {             dimAttriValue   = DimensionAttributeValue::findByDimensionAttributeAndVa...

Positive Pay file in D365FO using XSLT File

Image
Hi All, This post regarding PositivePay file preparation using XSLT in D365FO. The PositivePay Process generates a file that is based on the logic within the transfer file(XSLT) We can prepare a  Positive pay file in two ways. 1.Using XSLT File 2.Using BankPositivePayExport Class Once you prepare XSLT file, upload into PositivePay File Formats Form in D365Fo for a particular bank. Without writing any piece of code we achieve below requirement with the help of XSLT. There is already sample file available from Microsoft blog but how we can customize as per requirement will see now. Assume that below is the requirement.     Header Format: Details Format:                                                                         ...

Links to explore about LCS & D365FO

Links to explore about LCS & D365FO http://d365technext.blogspot.com/ https://sandeepchaudhury.wordpress.com/tag/d365fo/

X++ Code to read XML file in D365FO

X++ Code to read XML file in D365FO Hi Guys, The below code will help you to read an XML file from Local File Path and insert into Table.         XmlDocument         xmlDocument;         XMLParseError       xmlError;         XmlNode             rootNode,bodyNode;         XMLNodeList         tagsList;         XmlNamedNodeMap     map;         int                 j;         RecordInsertList    recordInsertListCust;         CustomerTableTmp    customerTabletmp;         Str        fileName =@''D:Temp\customer.XML";                       xmlDocu...

X++ code to get Financial Dimensions in D365FO

  public void getFinancialDimensions()     {        DimensionAttributeValueSet  dimAttrValueSet;         DimensionAttributeValueSetItem  dimAttrValueSetItem;         DimensionAttributeValue     dimAttrValue;         DimensionAttribute          dimAttribute;         LedgerJournalTable          ledgerJourTable;         VendTable                   vendTable;         CustTable                   custTable;               ledgerJourTable = LedgerJournalTable::find('');//JournalNum         vendTable = VendTable::find('');//AccountNum         custTable = CustTable::find('');//Accoun...

Links for lookup in D365 FO

Links for lookup in D365 FO https://community.dynamics.com/ax/b/nareshsdynamicsaxblog/archive/2017/04/27/d365-ax7-form-design-control-level-event-handler-methods-onlookup http://www.prashanthnagaraju.com/2017/07/overriding-onlookup-form-method.html http://axhelper.com/?p=23559

x++ code to get Vendor Email Address based on Purpose in Dynamics 365 for Operations

public static  Email   getVendorEmailAddress()     {               VendTable  vendTable;         DirPartyLocation dirPartyLocation;         LogisticsElectronicAddress elecAddress;         LogisticsElectronicAddressRole elecAddressRole;         LogisticsLocationRole locRole;         Str vendNum;              vendNum='205181';//Vendor Number                 select firstonly  DirPartyLocation                     where dirPartyLocation.party ==  VendTable::find(vendNum).Party//Vendor Number             join   elecAddress                     where elecAddress.Location == dirPartyLocation.Loca...

Userful links Part-1

Directing Reports to Email: https://blogs.msdn.microsoft.com/dynamicsaxbi/2012/03/09/how-to-directing-reports-to-email/ PowerBI Links : https://blogs.msdn.microsoft.com/dynamicsaxbi/2016/12/12/power-bi-content-from-microsoft-and-your-partners/ https://blogs.msdn.microsoft.com/dynamicsaxbi/2016/06/23/authoring-and-distributing-power-bi-reports-with-dynamics-ax7/

Useful link for PowerBI and D365 FO Integration

https://organicax.com/2017/08/07/setting-up-and-environment-to-try-the-powerbi-report-models-part-1/ https://blogs.msdn.microsoft.com/dynamicsaxbi/2016/12/12/power-bi-content-from-microsoft-and-your-partners/

Useful link for Copy database from Azure SQL Database to a SQL Server environment in Dynamics 365 for Operations

https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/database/copy-database-from-azure-sql-to-sql-server

Model Import and export in D365

Useful link for Model Import and Export in D365 http://www.cloudfronts.com/model-importexport-in-dynamics-365-operations/ https://community.dynamics.com/enterprise/b/dynamics365enterprisecloudfronts/archive/2016/12/12/model-import-export-in-dynamics-365-operations

Table Browser in Dynamics 365 for operations

Hi Guys, We can browse table data in any browser if you know table name. Below is the example,provide parameters like cmp and tablename. Example: https://test-dev1aos.sandbox.ax.dynamics.com/Default.htm?mi=SysTableBrowser&tablename=CustTable&cmp=USMF Thanks