Posts

Showing posts with the label Workflow

How to get workflow approvers list using x++

WorkflowTable            workflowTable; WorkflowVersionTable     workflowVersionTable; WorkflowElementTable     workflowElementTable; WorkflowStepTable        workflowStepTable; WorkflowAssignmentTable workflowAssignmentTable; while select workflowAssignmentTable     join workflowStepTable     where workflowStepTable.RecId == workflowAssignmentTable.workflowStepTable     join workflowElementTable     where workflowElementTable.ElementId == workflowStepTable.ElementId     join workflowVersionTable     where workflowVersionTable.ConfigurationId == workflowElementTable.ConfigurationId         && workflowVersionTable.Enabled == NoYes ::Yes     join workflowTable     where workflowTable.RecId == workflowVersionTable.workflowTable     && workflowTable.DocumentTableName == "LeaveRequestHeader" {     info(strFmt( "%1" , workflowAssignmentTable.UserValue)); }           

Custom Workflow Development for Existing Forms

Image
                canSubmitToWorkflow is not working at all in D365FO extensions, but we can achieve this by creating custom workflow with new table which we will use sort of extension and associate the table with standard form extension. Following are the steps to create custom work flow and associate with existing form. Here I am created workflow for service order form this is located in service management module. Step-1 –  Create custom Enum or you can use existing.          Step-2 –  Create custom table (Table name: SMJ_ServiceOrderWorkflow) and add two fields Main field id and Status field extend both fields with appropriate Enum or EDTs. 1)       Main field is ServiceOrderID 2)       Status field is WorkflowStatus Step-3 –  Create relation on parent table and our newly created table on the basis of Main field id. Step-4 –  Create a Custom Query (Query name: SMJ_ServiceOrderWF) and     Add the newly created table

Create a Simple Approval Workflow in Microsoft Dynamics D365

Image
Step 1: Basing on the requirement create a new base enum or use the existing base enum Step 2:           Create new fields to your main table – Ex:  SMJ_PurchaseOrder •        Status – Enum Type -  SMJ_Workflow •        SubmittedBy – Edt  –  UserId •        SubmittedDateTime – Edt  –  DateSubmitted Set the properties for the above 3 fields  AllowEditOnCreate – No AllowEdit – No   Step 3: Add table level methods 1.                     Override the Method in the Main table– canSubmitToWorkflow 2.                     Create a new method (Not overridden method) in the main table as below. Below is the code: Override the Method in the Main table– canSubmitToWorkflow /// <returns></returns>     public boolean canSubmitToWorkflow( str _workflowType = '' )     {         boolean ret;         SMJ_PurchaseOrder     SMJ_PurchaseOrder;         select firstOnly SMJ_PurchaseOrder where SMJ_PurchaseOrder.P