Restrict non-admin users to open multiple sessions in AX 2012

Copy Paste the Following Code in startupPost method of info class in AOT void startupPost() { xSession session; SysClientSessions SysClientSessions; UserId currentUserId; int counter;   currentUserId = curUserId(); if (!isSystemAdministrator())// Allow Admin User to login multiple time { while select SysClientSessions where SysClientSessions.userId == currentUserId && SysClientSessions.clientType == 0 { session = new xSession(SysClientSessions.SessionId, true); […]

Hide Export file format : SSRS Report Viewer using X++

Sample Code to hide the Export option from SSRS report viewer using x++   STEP 1: First We need to add the reference “Microsoft.ReportViewer.WinForms” in AOT STEP 2:  Add the below code into the Form “SRSReportViewer’   public void hideExportButton()public void hideExportButton() { System.Windows.Controls.UIElementCollection children;    Microsoft.Reporting.WinForms.ReportViewer reportViewer; children = _axreportViewer_control.get_Children();    reportViewer = children.get_Item(0); reportViewer.set_ShowExportButton(false); […]

Check physical existance of file

One of many ways to check file existance on folder for Client side :  WinAPI::fileExists(_fileName); And for Server side System.IO.FileInfo   fileInfo; new InteropPermission(InteropKind::ClrInterop).assert(); fileInfo = new System.IO.FileInfo(_fileName); return fileInfo.get_Exists();