SlideShare a Scribd company logo
1 of 5
Dynamics AX 2012 - Workflow Development in 2 hrs
Hi Friends,


First of all would like to wish you all Very   "Happy and Dynamics new year
-2012".
You all might be aware/heard of new changes related to worklow architecture and development.
So this post basically addresses,

1. Workflow Architecture changes
2. Workflow Development wizards
3. Generic class for submit/resubmit events on all workflows in AX.


1. Workflow Architecture changes

In 2012, AOS service has gone tremendous changes like

- Now you can directly host WCF services on AOS.
- Earlier version we were using IIS to interact with WWF(Windows workflow foundation) and
       WCF (Windows communication foundation).
- Because of above change, now no need to install workflow component separately
- Just run the workflow configuration wizard (available in System administration->Setup)
- Workflow templates/configuration were made available across companies/per company level.
- Workflow template is renamed to Workflow types

2. Workflow Development through wizards.

Let us develop workflow for
    'Customer approval- New created customer should be approved through workflow'

Step 1:
      Create a query for custTable say 'CustApprWorkflowQry' in AOT->Queries

Step 2:
      Duplicate enum 'PurchReqWorkflowState' and rename it to 'CustApprWorkflowState' and drag it
to CustTable Table.

Step 3:
      Override 'canSubmitToWorkflow' method on Table->CustTable and paste below code.

 //BP Deviation Documented
         public booleancanSubmitToWorkflow(str _workflowType = '')
         {
           boolean ret;

              ret = this.RecId != 0 &&this.CustApprWorkflowState ==
              CustApprWorkflowState::NotSubmitted;

              return ret;
          }


Create new method on CustTable as below to update worklow state during its life cycle.
//BP Deviation documented
            public static void UpdateCustWorkflowState(RefRecId _recId, CustApprWorkflowState
_state)
            {
                CustTablecustTable = CustTable::findRecId(_recId, true);

      ttsBegin;

      custTable.CustApprWorkflowState = _state;
      custTable.update();

      ttsCommit;
 }


Step 4:
          Create workflow type (template/configuration) through wizard available in 2012.

 Run wizard as below:

 AOT->Workflow-> Workflow types (Right click ->Add-Ins-> workflow type wizard...

 Specify values as shown in below image




  Click on next, as shown in below image wizard will create workflow eventhandlers class and menu
items for you.




 Paste below code to update workflow state.
//BP Deviation Documented
 public void started(WorkflowEventArgs _workflowEventArgs)
 {

CustTable::UpdateCustWorkflowState(_workflowEventArgs.parmWorkflowContext().parmRecId(), C
ustApprWorkflowState::Submitted);
 }

 //BP Deviation Documented
 public void completed(WorkflowEventArgs _workflowEventArgs)
 {

 CustTable::UpdateCustWorkflowState(_workflowEventArgs.parmWorkflowContext().parmRecId(), C
ustApprWorkflowState::Completed);
 }

 //BP Deviation Documented
 public void canceled(WorkflowEventArgs _workflowEventArgs)
 {

CustTable::UpdateCustWorkflowState(_workflowEventArgs.parmWorkflowContext().parmRecId(),
CustApprWorkflowState::PendingCancellation);
 }


Step 5:
       Create workflow approval through wizard available in 2012.

 Run wizard as below:

 AOT->Workflow->Approvals (Right click ->Add-Ins-> Approval wizard...

 Specify values as shown in below image




  Click on next, as shown in below image wizard will create workflow element eventhandlers and menu
items for you.
Paste below code to update workflow state.

 //BP Deviation Documented
 public void started(WorkflowElementEventArgs _workflowElementEventArgs)
 {

 CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmR
ecId(), CustApprWorkflowState::Submitted);
 }

 //BP Deviation Documented
 public void returned(WorkflowElementEventArgs _workflowElementEventArgs)
 {

 CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmR
ecId(), CustApprWorkflowState::Returned);
 }

 //BP Deviation Documented
 public void changeRequested(WorkflowElementEventArgs _workflowElementEventArgs)
 {

CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmRe
cId(), CustApprWorkflowState::ChangeRequest);
 }

 //BP Deviation Documented
 public void completed(WorkflowElementEventArgs _workflowElementEventArgs)
 {

CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmRe
cId(), CustApprWorkflowState::Approved);
 }

 //BP Deviation Documented
 public void canceled(WorkflowElementEventArgs _workflowElementEventArgs)
 {

 CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmR
ecId(), CustApprWorkflowState::PendingCancellation);
 }

Step 6:
      Enable workflow on CustTableListPage form and alos drag field CustApprWorkflowstate on
form overview grid, as below

      CustTableListPage->Design, set properties as below




Step 7:
      Download below class to activate workflow on submit and resubmit.

      This is generic class and with little modification can be used for all different worklow's in AX.
      Download Class XPO :

     Once you download and import class, change below menu-items associated with submit and
resubmit actions.




Step 8:
      Run Incremental CIL generation, AOT->Right click-> Incremental CIL generation

You are done with development and can configure workflow in AR->Setup
After activating above workflow configuration test it by creating new customer in CustTableListPage
form.

Hope you enjoyed this new style of workflow development which will take 1-2 hours for any new
basic workflow approval :)

More Related Content

What's hot

Retail store connect technical reference
Retail store connect technical referenceRetail store connect technical reference
Retail store connect technical reference
Ahmed Farag
 
Crystal Reports Review
Crystal Reports ReviewCrystal Reports Review
Crystal Reports Review
Justin R. Rue
 
Informatica PowerAnalyzer 4.0 3 of 3
Informatica PowerAnalyzer 4.0 3 of 3Informatica PowerAnalyzer 4.0 3 of 3
Informatica PowerAnalyzer 4.0 3 of 3
ganblues
 
Crystal Report Configuration Using xCP Designer 2.1
Crystal Report Configuration Using xCP Designer 2.1Crystal Report Configuration Using xCP Designer 2.1
Crystal Report Configuration Using xCP Designer 2.1
Haytham Ghandour
 
CaseStudy-MohammedImranAlam-Xcelsius
CaseStudy-MohammedImranAlam-XcelsiusCaseStudy-MohammedImranAlam-Xcelsius
CaseStudy-MohammedImranAlam-Xcelsius
Mohammed Imran Alam
 
Query Analyser , SQL Server Groups, Transact –SQL
Query Analyser , SQL Server Groups, Transact –SQLQuery Analyser , SQL Server Groups, Transact –SQL
Query Analyser , SQL Server Groups, Transact –SQL
Komal Batra
 
Creating Workflows Windows Share Point Services
Creating Workflows Windows Share Point ServicesCreating Workflows Windows Share Point Services
Creating Workflows Windows Share Point Services
LiquidHub
 

What's hot (20)

Retail store connect technical reference
Retail store connect technical referenceRetail store connect technical reference
Retail store connect technical reference
 
AX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideAX 2012 R3 Installation Guide
AX 2012 R3 Installation Guide
 
Crystal Reports Review
Crystal Reports ReviewCrystal Reports Review
Crystal Reports Review
 
Microsoft SQL Azure - Developing And Deploying With SQL Azure Whitepaper
Microsoft SQL Azure - Developing And Deploying With SQL Azure WhitepaperMicrosoft SQL Azure - Developing And Deploying With SQL Azure Whitepaper
Microsoft SQL Azure - Developing And Deploying With SQL Azure Whitepaper
 
Crystal reports seminar
Crystal reports seminarCrystal reports seminar
Crystal reports seminar
 
Informatica PowerAnalyzer 4.0 3 of 3
Informatica PowerAnalyzer 4.0 3 of 3Informatica PowerAnalyzer 4.0 3 of 3
Informatica PowerAnalyzer 4.0 3 of 3
 
Informatica PowerAnalyzer 4.0 1 of 3
Informatica PowerAnalyzer 4.0 1 of 3Informatica PowerAnalyzer 4.0 1 of 3
Informatica PowerAnalyzer 4.0 1 of 3
 
Crystal Report Configuration Using xCP Designer 2.1
Crystal Report Configuration Using xCP Designer 2.1Crystal Report Configuration Using xCP Designer 2.1
Crystal Report Configuration Using xCP Designer 2.1
 
Dbi h315
Dbi h315Dbi h315
Dbi h315
 
Test script
Test scriptTest script
Test script
 
Crystal report
Crystal reportCrystal report
Crystal report
 
Mds cdc implementation
Mds cdc implementationMds cdc implementation
Mds cdc implementation
 
Microsoft dynamics ax 2012 development introduction part 1/3
Microsoft dynamics ax 2012 development introduction part 1/3Microsoft dynamics ax 2012 development introduction part 1/3
Microsoft dynamics ax 2012 development introduction part 1/3
 
It ready dw_day4_rev00
It ready dw_day4_rev00It ready dw_day4_rev00
It ready dw_day4_rev00
 
Ax
AxAx
Ax
 
UI Testing Pattern
UI Testing PatternUI Testing Pattern
UI Testing Pattern
 
CaseStudy-MohammedImranAlam-Xcelsius
CaseStudy-MohammedImranAlam-XcelsiusCaseStudy-MohammedImranAlam-Xcelsius
CaseStudy-MohammedImranAlam-Xcelsius
 
Query Analyser , SQL Server Groups, Transact –SQL
Query Analyser , SQL Server Groups, Transact –SQLQuery Analyser , SQL Server Groups, Transact –SQL
Query Analyser , SQL Server Groups, Transact –SQL
 
Creating Workflows Windows Share Point Services
Creating Workflows Windows Share Point ServicesCreating Workflows Windows Share Point Services
Creating Workflows Windows Share Point Services
 
MS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining toolsMS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining tools
 

Viewers also liked

Enterprise portal development cookbook
Enterprise portal development cookbookEnterprise portal development cookbook
Enterprise portal development cookbook
Ahmed Farag
 
Xplusplus advancedcoursemanualv3.0 axapta
Xplusplus advancedcoursemanualv3.0 axaptaXplusplus advancedcoursemanualv3.0 axapta
Xplusplus advancedcoursemanualv3.0 axapta
Ahmed Farag
 
Creating a retail store in ax 2012 retail
Creating a retail store in ax 2012 retailCreating a retail store in ax 2012 retail
Creating a retail store in ax 2012 retail
Ahmed Farag
 
What's new with ADAX Retail Distribution?
What's new with ADAX Retail Distribution?What's new with ADAX Retail Distribution?
What's new with ADAX Retail Distribution?
daisytvh
 
Module 5 topic 1
Module 5 topic 1Module 5 topic 1
Module 5 topic 1
Annie cox
 
Ηλεκτρομαγνητισμός
ΗλεκτρομαγνητισμόςΗλεκτρομαγνητισμός
Ηλεκτρομαγνητισμός
Eyurt
 
Cuoc song tinh yeu tieng cuoi tech24.vn
Cuoc song tinh yeu tieng cuoi tech24.vnCuoc song tinh yeu tieng cuoi tech24.vn
Cuoc song tinh yeu tieng cuoi tech24.vn
Jenny Nguyen
 
Question ISTQB foundation 3
Question ISTQB foundation 3Question ISTQB foundation 3
Question ISTQB foundation 3
Jenny Nguyen
 
Making Social Medial Work For You
Making Social Medial Work For YouMaking Social Medial Work For You
Making Social Medial Work For You
Robert Furr
 
So what happens now prologue
So what happens now prologueSo what happens now prologue
So what happens now prologue
AuroraDay01
 
Some rules about poetry
Some rules about poetrySome rules about poetry
Some rules about poetry
Carolyn
 

Viewers also liked (20)

Enterprise portal development cookbook
Enterprise portal development cookbookEnterprise portal development cookbook
Enterprise portal development cookbook
 
Morph xit
Morph xitMorph xit
Morph xit
 
Xplusplus advancedcoursemanualv3.0 axapta
Xplusplus advancedcoursemanualv3.0 axaptaXplusplus advancedcoursemanualv3.0 axapta
Xplusplus advancedcoursemanualv3.0 axapta
 
Creating a retail store in ax 2012 retail
Creating a retail store in ax 2012 retailCreating a retail store in ax 2012 retail
Creating a retail store in ax 2012 retail
 
Send email
Send emailSend email
Send email
 
Dynamics AX 2012 R3 release is OUT!
Dynamics AX 2012 R3 release is OUT!Dynamics AX 2012 R3 release is OUT!
Dynamics AX 2012 R3 release is OUT!
 
What's new with ADAX Retail Distribution?
What's new with ADAX Retail Distribution?What's new with ADAX Retail Distribution?
What's new with ADAX Retail Distribution?
 
Module 5 topic 1
Module 5 topic 1Module 5 topic 1
Module 5 topic 1
 
Ηλεκτρομαγνητισμός
ΗλεκτρομαγνητισμόςΗλεκτρομαγνητισμός
Ηλεκτρομαγνητισμός
 
Cuoc song tinh yeu tieng cuoi tech24.vn
Cuoc song tinh yeu tieng cuoi tech24.vnCuoc song tinh yeu tieng cuoi tech24.vn
Cuoc song tinh yeu tieng cuoi tech24.vn
 
Animal nutrition
Animal nutritionAnimal nutrition
Animal nutrition
 
Ôn tập kiến thức ISTQB
Ôn tập kiến thức ISTQBÔn tập kiến thức ISTQB
Ôn tập kiến thức ISTQB
 
Hannah Clancy
Hannah Clancy Hannah Clancy
Hannah Clancy
 
Ben brown
Ben brownBen brown
Ben brown
 
Question ISTQB foundation 3
Question ISTQB foundation 3Question ISTQB foundation 3
Question ISTQB foundation 3
 
Presentation on Blog
Presentation on BlogPresentation on Blog
Presentation on Blog
 
Making Social Medial Work For You
Making Social Medial Work For YouMaking Social Medial Work For You
Making Social Medial Work For You
 
So what happens now prologue
So what happens now prologueSo what happens now prologue
So what happens now prologue
 
1st Semester Quick Review
1st Semester Quick Review1st Semester Quick Review
1st Semester Quick Review
 
Some rules about poetry
Some rules about poetrySome rules about poetry
Some rules about poetry
 

Similar to Dynamics ax 2012 workflow development

Oa Framework Tutorial
Oa Framework TutorialOa Framework Tutorial
Oa Framework Tutorial
nolimit797
 
07 b 01workflowdefinition
07 b 01workflowdefinition07 b 01workflowdefinition
07 b 01workflowdefinition
tflung
 
Sappsmoduletutorial 130129062429-phpapp02
Sappsmoduletutorial 130129062429-phpapp02Sappsmoduletutorial 130129062429-phpapp02
Sappsmoduletutorial 130129062429-phpapp02
Subhasis Sarkar
 
Redux. From twitter hype to production
Redux. From twitter hype to productionRedux. From twitter hype to production
Redux. From twitter hype to production
FDConf
 
Sap ps module tutorial
Sap ps module tutorialSap ps module tutorial
Sap ps module tutorial
achyuth10
 
1 Database Security Lab 2 – Virtual Private Database.docx
1 Database Security Lab 2 – Virtual Private Database.docx1 Database Security Lab 2 – Virtual Private Database.docx
1 Database Security Lab 2 – Virtual Private Database.docx
jeremylockett77
 
Portfolio For Charles Tontz
Portfolio For Charles TontzPortfolio For Charles Tontz
Portfolio For Charles Tontz
ctontz
 

Similar to Dynamics ax 2012 workflow development (20)

]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3
 
Oa Framework Tutorial
Oa Framework TutorialOa Framework Tutorial
Oa Framework Tutorial
 
07 b 01workflowdefinition
07 b 01workflowdefinition07 b 01workflowdefinition
07 b 01workflowdefinition
 
Sappsmoduletutorial 130129062429-phpapp02
Sappsmoduletutorial 130129062429-phpapp02Sappsmoduletutorial 130129062429-phpapp02
Sappsmoduletutorial 130129062429-phpapp02
 
]project-open[ Workflow Developer Tutorial Part 2
]project-open[ Workflow Developer Tutorial Part 2]project-open[ Workflow Developer Tutorial Part 2
]project-open[ Workflow Developer Tutorial Part 2
 
Ad basic tech_workshop
Ad basic tech_workshopAd basic tech_workshop
Ad basic tech_workshop
 
Task scheduling in laravel 8 tutorial
Task scheduling in laravel 8 tutorialTask scheduling in laravel 8 tutorial
Task scheduling in laravel 8 tutorial
 
Redux. From twitter hype to production
Redux. From twitter hype to productionRedux. From twitter hype to production
Redux. From twitter hype to production
 
Flavours - Classic/Technical BDD
Flavours - Classic/Technical BDDFlavours - Classic/Technical BDD
Flavours - Classic/Technical BDD
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_cs
 
Sap ps module tutorial
Sap ps module tutorialSap ps module tutorial
Sap ps module tutorial
 
Redux. From twitter hype to production
Redux. From twitter hype to productionRedux. From twitter hype to production
Redux. From twitter hype to production
 
Jsf intro
Jsf introJsf intro
Jsf intro
 
Wave Workshop
Wave WorkshopWave Workshop
Wave Workshop
 
1 Database Security Lab 2 – Virtual Private Database.docx
1 Database Security Lab 2 – Virtual Private Database.docx1 Database Security Lab 2 – Virtual Private Database.docx
1 Database Security Lab 2 – Virtual Private Database.docx
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Murach : How to work with session state and cookies
Murach : How to work with session state and cookiesMurach : How to work with session state and cookies
Murach : How to work with session state and cookies
 
Demo how to create visualforce and apex controller to update, delete custom o...
Demo how to create visualforce and apex controller to update, delete custom o...Demo how to create visualforce and apex controller to update, delete custom o...
Demo how to create visualforce and apex controller to update, delete custom o...
 
Cbse computer science (c++) class 12 board project bank managment system
Cbse computer science (c++)  class 12 board project  bank managment systemCbse computer science (c++)  class 12 board project  bank managment system
Cbse computer science (c++) class 12 board project bank managment system
 
Portfolio For Charles Tontz
Portfolio For Charles TontzPortfolio For Charles Tontz
Portfolio For Charles Tontz
 

Dynamics ax 2012 workflow development

  • 1. Dynamics AX 2012 - Workflow Development in 2 hrs Hi Friends, First of all would like to wish you all Very "Happy and Dynamics new year -2012". You all might be aware/heard of new changes related to worklow architecture and development. So this post basically addresses, 1. Workflow Architecture changes 2. Workflow Development wizards 3. Generic class for submit/resubmit events on all workflows in AX. 1. Workflow Architecture changes In 2012, AOS service has gone tremendous changes like - Now you can directly host WCF services on AOS. - Earlier version we were using IIS to interact with WWF(Windows workflow foundation) and WCF (Windows communication foundation). - Because of above change, now no need to install workflow component separately - Just run the workflow configuration wizard (available in System administration->Setup) - Workflow templates/configuration were made available across companies/per company level. - Workflow template is renamed to Workflow types 2. Workflow Development through wizards. Let us develop workflow for 'Customer approval- New created customer should be approved through workflow' Step 1: Create a query for custTable say 'CustApprWorkflowQry' in AOT->Queries Step 2: Duplicate enum 'PurchReqWorkflowState' and rename it to 'CustApprWorkflowState' and drag it to CustTable Table. Step 3: Override 'canSubmitToWorkflow' method on Table->CustTable and paste below code. //BP Deviation Documented public booleancanSubmitToWorkflow(str _workflowType = '') { boolean ret; ret = this.RecId != 0 &&this.CustApprWorkflowState == CustApprWorkflowState::NotSubmitted; return ret; } Create new method on CustTable as below to update worklow state during its life cycle.
  • 2. //BP Deviation documented public static void UpdateCustWorkflowState(RefRecId _recId, CustApprWorkflowState _state) { CustTablecustTable = CustTable::findRecId(_recId, true); ttsBegin; custTable.CustApprWorkflowState = _state; custTable.update(); ttsCommit; } Step 4: Create workflow type (template/configuration) through wizard available in 2012. Run wizard as below: AOT->Workflow-> Workflow types (Right click ->Add-Ins-> workflow type wizard... Specify values as shown in below image Click on next, as shown in below image wizard will create workflow eventhandlers class and menu items for you. Paste below code to update workflow state.
  • 3. //BP Deviation Documented public void started(WorkflowEventArgs _workflowEventArgs) { CustTable::UpdateCustWorkflowState(_workflowEventArgs.parmWorkflowContext().parmRecId(), C ustApprWorkflowState::Submitted); } //BP Deviation Documented public void completed(WorkflowEventArgs _workflowEventArgs) { CustTable::UpdateCustWorkflowState(_workflowEventArgs.parmWorkflowContext().parmRecId(), C ustApprWorkflowState::Completed); } //BP Deviation Documented public void canceled(WorkflowEventArgs _workflowEventArgs) { CustTable::UpdateCustWorkflowState(_workflowEventArgs.parmWorkflowContext().parmRecId(), CustApprWorkflowState::PendingCancellation); } Step 5: Create workflow approval through wizard available in 2012. Run wizard as below: AOT->Workflow->Approvals (Right click ->Add-Ins-> Approval wizard... Specify values as shown in below image Click on next, as shown in below image wizard will create workflow element eventhandlers and menu items for you.
  • 4. Paste below code to update workflow state. //BP Deviation Documented public void started(WorkflowElementEventArgs _workflowElementEventArgs) { CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmR ecId(), CustApprWorkflowState::Submitted); } //BP Deviation Documented public void returned(WorkflowElementEventArgs _workflowElementEventArgs) { CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmR ecId(), CustApprWorkflowState::Returned); } //BP Deviation Documented public void changeRequested(WorkflowElementEventArgs _workflowElementEventArgs) { CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmRe cId(), CustApprWorkflowState::ChangeRequest); } //BP Deviation Documented public void completed(WorkflowElementEventArgs _workflowElementEventArgs) { CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmRe cId(), CustApprWorkflowState::Approved); } //BP Deviation Documented public void canceled(WorkflowElementEventArgs _workflowElementEventArgs) { CustTable::UpdateCustWorkflowState(_workflowElementEventArgs.parmWorkflowContext().parmR ecId(), CustApprWorkflowState::PendingCancellation); } Step 6: Enable workflow on CustTableListPage form and alos drag field CustApprWorkflowstate on
  • 5. form overview grid, as below CustTableListPage->Design, set properties as below Step 7: Download below class to activate workflow on submit and resubmit. This is generic class and with little modification can be used for all different worklow's in AX. Download Class XPO : Once you download and import class, change below menu-items associated with submit and resubmit actions. Step 8: Run Incremental CIL generation, AOT->Right click-> Incremental CIL generation You are done with development and can configure workflow in AR->Setup After activating above workflow configuration test it by creating new customer in CustTableListPage form. Hope you enjoyed this new style of workflow development which will take 1-2 hours for any new basic workflow approval :)