Posts

Email sending in D365 fo x++

  public void sendMail()  {      EcoResProductParameters prodParameter = EcoResProductParameters::find();      str createdByEmail =  SysUserInfo::getUserEmail(itemRequests.CreatedBy);      SysMailerMessageBuilder builder = new SysMailerMessageBuilder()          .setFrom(SysEmailParameters::find().SMTPUserName)              .addTo(createdByEmail)              .addCc(prodParameter.MK_MailCC)              .setSubject(strFmt(prodParameter.MK_MailccSubject, itemRequests.ItemReqId))              .setBody("<html><body><p style=text-align: left; direction: ltr>"+strFmt(prodParameter.MK_MailNotes ,itemRequests.DisplayProductNumber,itemRequests.ItemReqId)+"</p></body></html>");      SysMailerFactory::sendNonI...

send email using sysoutgoing in D365 fo x++

 class DSASendReportAsEmailAttachmentServiceclass extends SysOperationServiceBase {          Map           mappings = new Map(Types::String,Types::String);     //Args          _args;     public void process()     {         custTable     custTable;         while select custTable           where custTable.AccountNum == '10-30001'         {             this.generateAndSendCustStatementReport(custTable.AccountNum);         }     }     public void generateAndSendCustStatementReport(CustAccount  _custAccount)     {         //Set  variables         custTable                       custTable; ...

MutiSelet Look up on tmp table in d365 fo x++

  public void lookup()  {      container AssetCon;      FormRun frlocal = this.formRun();      FormRun CallerFormRun = frlocal.args().caller();      if( CallerFormRun.args().caller())      {          FormRun ParentCallerFormRun = CallerFormRun.args().caller();          FormDataSource ParentCallerFormDatasource = ParentCallerFormRun.dataSource(formDataSourceStr(EntAssetWorkOrderTable,WorkOrderLine));          MK_EntAssetTmpSchedule_MK_ObjectID_Tmp tmpTable;          EntAssetWorkOrderLine   workOrderLine;          MultiSelectionHelper        multiSelectionHelper    = MultiSelectionHelper::construct();          multiSelectionHelper.parmDatasource(ParentCallerFormDatasource);          workOrderLi...

how to sync FO custom field in D365 fo Retail Database

Image
so i have a requirement to push extension field data to channel database so we can use in POS side. for this what i have done is defined below these are the custom field in D365 fo table. to Push these field to retail I have created a custom table in FO in which we have the same custom field which we required in POS side . this is the custom table contain all that custom field  and save data per company is set to no a custom field is created for dataareaId  due to some reasons. After that create a code extention of CustParamter Table and did this code to insert and update data in Or custom table. [ExtensionOf(tableStr(CustParameters))] final class CustParameters_SIL_TUCustomizations_Extension {     void update()     {         next  update();         this.createOrUpdateTUCustParametersExt(this);     }     public void insert()     {         next  insert(); ...

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           ...