Posts

Showing posts from September, 2023

X++ code to Delete multiple selected records from a form

  This code will delete the selected records from the form. Note :- Override clicked method of button. And enable multi select property of the button and put the code  public void clicked()         {                        super();             Employee_ds.deleteMarked();           }

X++ code to retrieve multiple selected records from Grid using X++

  X++ code to retrieve multiple selected records from Grid using X++.  public void clicked()         {             int             recordsCount;             BASTradeAgreementTable    tradeAgreement;             super(); recordsCount = BASTradeAgreementTable_ds.recordsMarked().lastIndex();  // Total number of marked records.            tradeAgreement = BASTradeAgreementTable_ds.getFirst(1);      while (tradeAgreement)                 {                  info(strFmt("%1 - %2 ", tradeAgreement.FromDate, tradeAgreement.ToDate));  tradeAgreement = BASTradeAgreementTable_ds.getNext(); } }

Custom service to create and close a container in Advanced warehouse management (AWM) D365FO

  Description :-  In Advanced Warehousing within Dynamics 365 the term "Container Closer" refers to the process of finalizing and completing various warehouse tasks and operations. This is a crucial step in the warehouse management process, this service performs this task, as it signifies that the specific tasks have been executed and the related transactions have been processed in the system. Custom service to be developed to Container closure in D365. Input: Shipment ID, Quantity, Item, Container ID Expected Output: Container Closure in D365 (Validation has to be done along with Container  closure) Create below mentioned objects :-  Request contract :- To get user inputs to create and close container. Response contract :- To give response (Task Confirmation message). Helper class :- To write the business logic. Service class :- To call the API out side of environment. Request class :-  /// <summary> /// Request contract for BASMSAdvanceWarehouseManagemen...

X++ code to create excel file and send it through mail in D365FO

  This code will help to create excel file and send it through  mail. Note :-  SMTP parameters settings needs to be done to send mail from D365FO. refer https://www.linkedin.com/pulse/sending-emailsnotification-from-d365-fo-x-saim-siddiqui/  Code :-  class BASSendEmailWithAttachmentJob {     /// <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)     {         SalesTable              salesTable;         SysMailerMessageBuilder mailBuilder = new SysMailerMessageBuilder();         SysMailerSMTP        ...

How to Use a .NET Project Within a D365FO Solution

Image
  step1 : create a x++ project step2 : Select Class Library (.NET Framework) step3:  Enter a Project Name and Location, then select .NET Framework 4.7.2 – the reason for this is that if we want to reference any Microsoft DLLs we need to be sure our solution matches the project type and version that the DLLs are built against (which in the case of Microsoft DLLs is .NET Framework 4.7.2) step4 :  Next we need to create a reference between our X++ project and our .NET project, right click on the References and ‘Add Reference’ step5 :  Next select your .NET project from the Projects tab step6 :  Now you will see your .NET project is referenced by your X++ project So Now I Can Reference Microsoft DLLs from the .NET Class? 1) Right click on the References tab on your .NET project -> Add Reference 2) Click on Browse -> Then the Browse button 3) Navigate to the PackagesLocalDirectory folder (on my development onebox this is located at K:\AosService\PackagesLocalDi...

x++ code to submit and approve and reject the invent movement workflow in d365 F&O

 class Class1 {     public  void submitworkflow()     {         InventJournalTable journalTable;     WorkflowWorkItemTable   WorkflowWorkItemTable;    WorkflowVersionTable        workflowVersionTable;                journalTable = InventJournalTable::find('00446');               // submit to workflow         if (journalTable.WorkflowApprovalStatus == InventJournalWorkflowApprovalStatus::NotSubmitted)         {             Workflow::activateFromWorkflowType(workFlowTypeStr(InventJournalMovementTemplate), journalTable.RecId,                                     'Workflow submitted by button', false, Curuserid());         }    ...

X++ code to submit and approve the invent movement workflow using custom service in dynamics 365 F&O

Request Class : [DataContractAttribute("BASMSInventoryMovementRequestContract")] class BASMSInventoryMovementRequestContract {     str journalId;     str dataAreaId;     [DataMemberAttribute("JournalId")]     public str parmjournalId(str _journalId = journalId)     {         journalId = _journalId;         return journalId;     }     [DataMemberAttribute("dataAreaId")]     public str parmdataAreaId(str _dataAreaId = dataAreaId)     {         dataAreaId = _dataAreaId;         return dataAreaId;     } }  Response Class : [DataContractAttribute("BASMSInventoryMovementResponseContract")] class BASMSInventoryMovementResponseContract {     str workFlowApprovalStatus;     List errorList;     [DataMember('WorkflowApprovalStatus')]     public str parmworkFlowApprovalStatus(s...

x++ code to create call center order through custom service

  Creation Of Call Center Orders through Postman Request Contract Class: [DataContractAttribute("BASMSCreationOfCallCenterOrdersRequestContract")] class BASMSCreationOfCallCenterOrdersRequestContract {     str             custAccount;     str             dataAreaId;     str             siteId;     str             warehouse;     int             numberOfOrders;     str             orderStatus;     List            itemsList,paymentsList;     [DataMemberAttribute("CustAccount")]     public str parmCustAccount(str _custAccount = custAccount)     {         custAccount = _custAccount;         return custAccount; ...