Skip to main content

Posts

Showing posts from 2013

Store and retrieve an image in a table for a record in AX

The simplest way to store an image for a record into AX tables is by using the CompanyImage Menu Item. I will explain you with an example below: Generally, most of the customers would request for a functionality to store an image for an item. For this, there is no need of high customization. Initially, Goto the Design in InventTable Form and add a Display Menu Item called CompanyLogo to its button Group. Change the label of the Menu item button in the form. Now, open the InventTable form and click on the menu item and load an image associated with a record. This image will be stored in the CompanyImage table as a BLOB in a container with the refRecId, RefTableId and RefCompanyId of the associated record(Here Record of InventTable). Retrieving it and saving to file system again is pretty easy with the help of binData Class. Here is the supporting code snippet.... bindata   bin = new bindata(); str    content; container image; InventTable inventTable; ; in

Better business insight with Microsoft Dynamics AX 2012 R2

Many organizations struggle with providing business insight in a timely manner as resource-constrained IT departments can’t keep up with the requests from business users. Far too often users are spending too much unproductive time creating manual reports that are static and outdated. Facing ever-accelerating change and the pressure from more prevalent global competition, it is more important than ever that organizations have instant access to up-to-date financial and operational performance to spot trends and identify challenges so they can act early. In previous versions of Microsoft Dynamics AX we enabled business intelligence as part of the ERP experience. The business user can access important information throughout the solution, via Role Center pages, which are dashboards that provide an overview of information that pertains to a user’s job function and by using Microsoft BI technology such as Microsoft Excel. In Microsoft Dynamics AX 2012 R2 we further improved the BI capa

How to print the SSRS report in dynamics ax 2012 from code.

SrsReportRun srsReportRun;     // initiate the report.     srsReportRun = new SrsReportRun ( "InventTruckTransactionReport.PrecisionDesign1" );     srsReportRun.init();     srsReportRun.reportCaption( "InventTruckTransactionReport.PrecisionDesign1" );     // set parameters name, value.     srsReportRun.reportParameter( "TruckTransDS_JournalId" ).value( "000161_070" );     // suppress the dialog     srsReportRun.showDialog( false );     if ( srsReportRun )     {         // run the report         srsReportRun.executeReport();     }

How to send emails from AX without requiring Outlook

Sending emails from AX has been somewhat of a pain when it tries to use Outlook. This post is a simple code modification to one method in \Classes\Info\reportSendMail. I did not develop this code, I merely tweaked it. The original poster's blog has disappeared, and I can only find non-working remnants all around the web of this, but it is just too useful not to repost. If you have Outlook 64bit edition, you might get the "Either there is no default mail client or the current mail client cannot fulfill the messaging request. Please run Microsoft Outlook and set it as the default mail client." Followed by an AX MAPI error. Or sometimes you may get the "A program is trying to access e-mail address information stored in Outlook."...Allow/Deny/Hlep. This change basically bypasses outlook. Put it in and give it a shot. void reportSendMail(PrintJobSettings p1) { //SysINetMail m = new SysINetMail(); System.Net.Mail.MailMessage mailM

AX 2012 SSRS Report: Multiple report design under Print management

AX 2012 SSRS Report: Multiple design under Print management If new formats for Sales order confirmation/Picking/Packing/Invoice Purchase order postings etc. are needs to be added. Following steps needs to be performed. Step1. Create new Design for report under visual studio Step2. Add code to method: \Data Dictionary\Tables\PrintMgmtReportFormat\Methods\populate Add Code in the before TTSCOMMIT: addOther(PrintMgmtDocumentType::SalesOrderPackingSlip, ‘SalesPackingSlip.Report_XYZ,’SalesPackingSlip.Report_XYZ’ ,’XYZ’); Step 3. Setup the Format under: AR -> setup -> form setup -> Print management -> Sales order Packing slip original -> report format to SalesPackingslip.Report_XYZ Step 4. New Report design can be executed from use Print management from Inquiry journal forms or during posting by selecting Print management destination.

Save SSRS report to pdf that uses Controller classes [Dynamics AX 2012]

static   void  SR_SaveReportToPDFFromController(Args _args) {     SalesInvoiceController  salesInvoiceController;     SalesInvoiceContract    salesInvoiceContract;     Args                    args =  new  Args();     SrsReportRunImpl        srsReportRun;     CustInvoiceJour         custInvoiceJour;     ReportName              reportName =  "SalesInvoice.Report" ;     ;      select   firstOnly  custInvoiceJour;     args.record(custInvoiceJour);         salesInvoiceController =  new  SalesInvoiceController();     salesInvoiceController.parmReportName(reportName);         salesInvoiceContract = salesInvoiceController.parmReportContract().parmRdpContract();     salesInvoiceContract.parmRecordId(custInvoiceJour.RecId);  // Record id must be passed otherwise the report will be empty      salesInvoiceContract.parmCountryRegionISOCode(SysCountryRegionCode::countryInfo());  //  comment this code if tested in pre release     salesInvoiceController

Microsoft Dynamics AX 2012 Reporting - tips how to improve performance

Czesława Langowska Vliegen   18 Sep 2013 3:12 AM  0 There are some tips we can use to improve performance of reports for Dynamics AX 2012. Use static reports. The deployment of static reports is described here:  http://technet.microsoft.com/en-us/library/hh496446.aspx  In this way we will safe several calls to Metadata service to get labels values and correct formatting of dates and numbers. Install application hotfix KB 2879661 which fix the situation when first generation of a report after Dynamics AX client restart takes long. This happens for each user. Newest kernel . Hotfixes for performance improvement are included in new kernels that are released; sometimes there is a dramatic impact on performance. In the morning a first report generation takes a lot of time SSRS uses session pooling. The first request that comes in from a user – a session will be created for them within the AOS services. Each user gets a session cached on the AOS services, so subsequent ca

Using the Cross company feature from the Business Connector.

Peter Villadsen   19 Dec 2008 8:59 PM  1 In Ax 2009 the new cross company feature was introduced. It allows the programmer to specify a container containing strings denoting company names to the crosscompany hint: container c = ['dat', 'dmo']; select crosscompany: c * from custtable where custtable.Name == "Jones"; That is all very well in X++, of course, but how do you handle it when accessing data through the business connector? The first approach would be to do something like the following: AxaptaRecord r = axapta.CreateAxaptaRecord("CustTable"); ax.ExecuteStmt("select crosscompany: ['dmo', 'dat'] * from %1 where %1.Name == 'Jones'", r); However, that will not work: The argument to the crosscompany hint is not an expression of type container, it is a variable of type container. Hence you cannot provide arbitrary expressions, only variable references. This was done to make the implementation of the

Issues concerning X++

Peter Villadsen   19 May 2011 5:29 PM  0 I was looking at the API that we publish for the X++ compiler, and it struck me that it would be really easy to implement a script host for X++. This is a program that allows you to execute arbitrary X++ code that is stored in files in the file system. In this way, you can use X++ as a systems programming language, starting things at particular times etc. I thought it would be fun to see what it takes to implement that command line tool. In the spirit of sharing, I am listing the C# code below. It is, after all, only just over 100 lines of code. Let's imagine that we have a file called MyFile.xpp containing the following: real f(int i, real r, str s) {     ;     System.Console::WriteLine("Hello world");     return i + r + strlen(s); } With the script host installed, you can do things like: C\> XppScriptHost  MyFile.xpp 3  3.141 "I am an argument". The script host will return a code to the operating syste

How to install CU7 for Microsoft Dynamics AX 2012 R2

Sally Erickson [MSFT]   11 Nov 2013 6:50 AM  0 CU7 for Microsoft Dynamics AX 2012 R2 is now available! We’ve recently blogged about its new features and the resources that are available to help you learn more about it. (In case you missed those blog posts, click  here  and  here .) But today I want to focus on one thing, and it’s kind of important: how to install it. There are two ways to install CU7. The method that you should use boils down to how you answer this question: Is Microsoft Dynamics AX 2012 R2 already installed in your environment? Yes, AX 2012 R2 is already installed If AX 2012 R2 is already installed, use the Update Wizard and complete the update process to apply CU7. The process looks like this: Get ready for CU7: Review the release documentation. Download the files. Apply CU7 as an update: Prepare for the update. Install and analyze updates. Restart the AOS and IIS. Reinitialize the model store. Complete the software update checklist

Cumulative update 7 content now available for Microsoft Dynamics AX 2012 R2

Cumulative update 7 for Microsoft Dynamics AX 2012 R2  is now available on CustomerSource and PartnerSource and we've posted new content to support it on  TechNet  and  MSDN . To view details of the supporting content that is available for the new features in CU7, see  What's new in Microsoft Dynamics AX 2012 R2 cumulative update 7 . Also, the New, Changed, and Deprecated features guide is now available as individual topics in the  Microsoft Dynamics AX 2012 library  on TechNet. The guide has been thoroughly updated, so take a look! New features for each audience in CU7 include the following: Application users Module updates:  A number of features have been added for application users, particularly in the following modules: Accounts payable, Accounts receivable, Budgeting, Fixed assets, General ledger, Human resources, Inventory and warehouse management, Payroll, Procurement and sourcing, Product information management, Production control, Project management and accou

Configure email functionality in Dynamics AX 2012

Sally Erickson [MSFT]   14 Oct 2013 7:19 AM You can configure Microsoft Dynamics AX to automatically send email notifications to users when specific events occur. For example, Dynamics AX can send email notifications to users when documents are assigned to them for approval (as defined by a  workflow ), or when sales orders are canceled (as defined by an  alert rule ). To configure email functionality in Microsoft Dynamics AX, you’ll need to connect Dynamics AX to an SMTP mail server, enter an email address for each user, set up a batch to send the email messages, and create email templates for the specific features that you’re using (such as workflows and alert rules). The process looks like this: For step-by-step instructions on how to set this up, see this topic on TechNet:  Configure email functionality in Microsoft Dynamics AX . For instructions about how to set up email and address settings for customer contacts, see  Set up collections .

You Can Easily Get the Last Inserted/Updated/Deleted Dates as Follows:

CREATE FUNCTIOn fn_TablesLastUpdateDate(@Date NVARCHAR(20)) RETURNS @table TABLE(TableName NVARCHAR(40), LastUpdated Datetime) AS BEGIN IF(@Date='') OR (@Date Is Null) OR (@Date='0') BEGIN INSERT INTO @ table SELECT TOP 100 PERCENT TABLENAME , LASTUPDATED FROM ( SELECT B . NAME AS 'TABLENAME' , MAX ( STATS_DATE ( ID , INDID )) AS LASTUPDATED FROM SYS . SYSINDEXES AS A INNER JOIN SYS . OBJECTS AS B ON A . ID = B . OBJECT_ID WHERE B . TYPE = 'U' AND STATS_DATE ( ID , INDID ) IS NOT NULL GROUP BY B . NAME ) AS A ORDER BY LASTUPDATED DESC END ELSE BEGIN INSERT INTO @ table SELECT TOP 100 PERCENT TABLENAME , LASTUPDATED FROM ( SELECT B . NAME AS 'TABLENAME' , MAX ( STATS_DATE ( ID , INDID )) AS LASTUPDATED , CONVERT ( VARCHAR , MAX ( STATS_DATE ( ID , INDID )), 103 ) as Date