Posts

Check if the current user has a specific role or not via X++ in Microsoft Dynamics 365 F&O

  UserInfo userInfo; SecurityUserRole securityUserRole; SecurityRole Roles; boolean allowed; select id from userInfo join SecurityRole from securityUserRole where securityUserRole.User == userInfo.Id join Roles where Roles.RecId == securityUserRole.SecurityRole && (Roles.AotName =='ROLENAME') && UserInfo.id == curUserId(); if(UserInfo.id == curUserId()) { Allowed = true; }

How to get user to whom workflow is assigned using X++ in Dynamics 365 Finance & Operation

  public WorkflowUser isWorkflowApprover(Common _common) { WorkflowTrackingStatusTable workflowTrackingStatusTable; WorkflowTrackingTable workflowTrackingTable; select firstonly RecId from workflowTrackingStatusTable join User from workflowTrackingTable order by WorkflowTrackingTable.CreatedDateTime desc where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId && workflowTrackingStatusTable.ContextRecId == _common.RecId && workflowTrackingStatusTable.ContextTableId == _common.TableId && workflowTrackingTable.TrackingContext == WorkflowTrackingContext::WorkItem; return workflowTrackingTable.User; }

How to get any Report Name from Print Management in D365 FO x++

   private PrintMgmtReportFormatDescription getReportFormatDescription(PrintMgmtDocumentType _docType)   {       PrintMgmtReportFormatDescription printMgmtReportFormatDescription;       RecId printMgmtDocInstanceRecId = PrintMgmtDocInstance::getPrintMgmtDocRecId(           0,           0,           PrintMgmtNodeType::Sales,           _docType,           PrintMgmtDocInstanceType::Original);       if (printMgmtDocInstanceRecId)       {           PrintMgmtReportFormat printMgmtReportFormat;           PrintMgmtSettings printMgmtSettings;           select firstonly Description, SSRS from printMgmtReportFormat               exists join printMgmtSettings           ...

Generate Public URL of Attachment expose to 3rd parties without authentication

  internal final class TestClassV2 {     /// <summary>     /// Class entry point. The system will call this method when a designated menu      /// is selected or when execution starts and this class is set as the startup class.     /// </summary>     /// <param name = "_args">The specified arguments.</param>     public static void main(Args _args)     {         int64 _recId=22565437142; // refer to a record present in inventable  eg released product         DocuRef docuRef;         EcoResProductImage ecoResProductImage; // there can be multiple images against a product so we only creating url of image that is by default         select firstOnly docuRef     join ecoResProductImage         where ecoResProductImage.DefaultImage == NoYes::Yes         ...

get product image in D365 FO x++

  public str getProductImage(ItemId _itemId)     {         str                 imageBase64;         InventTable         inventTable = InventTable::find(_itemId);         EcoResProduct       product;         Common              firstRecord;         Common              secondRecord;         product             = EcoResProduct::find(inve...

Deploy Reports of specfic model

 C:\AOSService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "C:\AOSService\PackagesLocalDirectory" -Module DSTasaruCustomization

get view defination from SQL in x++

 select definition from sys.objects     o join sys.sql_modules m on m.object_id = o.object_id where o.object_id = object_id( 'dbo.DSPWorkerDetailView')   and o.type      = 'V'