First create a new dynamics webpart in .net. Need to perform few steps to enable the workflow in the required webpart.
a. Register workflow control in webpart.
<%@ Register Assembly="Microsoft.Dynamics.Framework.Portal, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="Microsoft.Dynamics.Framework.Portal.UI.WebControls.Workflow" TagPrefix="dynamics" %>
b. Add workflow control in webpart (place the code after datasource).
<dynamics:AxWorkflowActionBar ID="WorkflowActionBar" runat="server" DataSourceID="AxDataSource1" DataMember="{TableName}_Current" />
C. Under Editor, call the following namespace
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.Workflow;
d. Create the following method for calling CanSubmitToWorkflow method by using Proxy.
void WorkflowActionBar_EvaluatingCanSubmitToWorkflow(object sender, EvaluatingCanSubmitToWorkflowEventArgs e)
{
Boolean canSubmit;
IAxaptaRecordAdapter record = e.DocumentRecord;
ApplicationProxy.TM_PolicyMaster policyMaster = new ApplicationProxy.PolicyMaster(this.AxSession.AxaptaAdapter, record);
canSubmit = (Boolean)policyMaster.canSubmitToWorkflow();
e.CanSubmitToWorkflow = canSubmit;
}
(Note: Here PolicyMaster the Ax Table and canSubmitToWorkflow method is under the table and it is defined in proxy also. It returns boolean)
e. Create or update the page init method in webpart editor with following code
void Page_Init(object sender, EventArgs e
{
this.WorkflowActionBar.EvaluatingCanSubmitToWorkflow += new EventHandler<EvaluatingCanSubmitToWorkflowEventArgs>(WorkflowActionBar_EvaluatingCanSubmitToWorkflow);
}
f. Create three WebActionMenuItems in DAX with EPWorkflowWorkItemActionManager class.
Set label: Web Approve, Web Reject and Web request to Change
Set Run On = Called from
g. Create another two WebActionMenuItems in DAX with your created Submit class.
Set label: Web Submit and Web Re-submit.
h. Modify Submit class for Submitting workflow.
DialogOk, init and reSubmit method
And now workflow is ready for web. Please reset the IIS and Refresh AOD from EP before the submit of Workflow.
And now workflow is ready for web. Please reset the IIS and Refresh AOD from EP before the submit of Workflow.
1 comment:
This is another blog which i get very useful for dynamics learner
http://daynamicsaxaptatutorials.blogspot.com/
Post a Comment