Add an Assembly Reference
Select the AXUserControl on which you want to enable workflow then right click & select View Markup. Add the following lines to View Markup.
<%@ 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" %>
Add AXWorkflowActionBar
Add the following lines to the View Markup.
This is the Data bound control, the DataMember & DataSourceID must be set according to your scenario. DataMember property must be set the table on which the workflow enabled.
<dynamics:AxWorkflowActionBar ID="WorkflowActionBar" runat="server"
DataMember="SalesTable_Current" DataSourceID="dsEPSalesTableList" >
</dynamics:AxWorkflowActionBar>
Add Namespace
To implement the methods related to workflow control in the code sheet(C# code sheet)add the following line.
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.Workflow;
Changes to do in AX
Set the property 'SubmitToWorkflowWebMenuItem' of corresponding workflow template as shown below.
Set the property 'DocumentWebMenuItem' of corresponding workflow Approvals as shown below.
Create Action Web Menu Items for Approve, Reject & Deny as shown below.
Assign the newly created Action Web Menu Items to Approvals -> Approve,Reject & Deny as shown below.
Adding code to support Enterprise Portal Workflow Submission
Add the following code in Workflow submit class of submission method.
Write a method on SalesTable canSubmitToWorkflow
Add this method to Proxy and Generate Proxy.
Evaluating CanSubmitToWorkflow Event in C# Code
void Page_Init(object sender, EventArgs e)
{
//Subscribe to the EvaluatingCanSubmitToWorkflow event
this.WorkflowActionBar.EvaluatingCanSubmitToWorkflow += new EventHandler<EvaluatingCanSubmitToWorkflowEventArgs>(WorkflowActionBar_EvaluatingCanSubmitToWorkflow);
}
void WorkflowActionBar_EvaluatingCanSubmitToWorkflow(object sender, EvaluatingCanSubmitToWorkflowEventArgs e)
{
// Evaluate state of document and set value to true or false
IAxaptaRecordAdapter record = e.DocumentRecord;
ApplicationProxy.SalesTable salesTable = new ApplicationProxy.SalesTable(this.AxSession.AxaptaAdapter, record);
if (salesTable.canSubmitToWorkflow())
e.CanSubmitToWorkflow = true;
}
Good post Shankar. Keep posting
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi Shankar,
ReplyDeleteIt's good
I used same step but i got error like
Unknown server tag 'dynamics:AxWorkflowBar'
could you please help me...
Hi Paul,
ReplyDeleteYou might not added assembly reference. Check the 1st & 2nd steps again.
will this same procedure works for ax 2012
ReplyDelete