37
Developing Reusable Workflow Features (Fri-S2A-106) Dev Track – 200 Mike Oryszak (@next_connect) Intellinet Aug 12, 2011 Welcome to SharePoint Saturday—The Conference

Spstc2011 Developing Reusable Workflow Features

Embed Size (px)

DESCRIPTION

Overview of approaches to increase reuse in Workflow projects as well as an overview of creating custom Actions in Visual Studio 2010.

Citation preview

Page 1: Spstc2011   Developing Reusable Workflow Features

Developing Reusable Workflow Features

(Fri-S2A-106)Dev Track – 200

Mike Oryszak (@next_connect)Intellinet

Aug 12, 2011

Welcome to SharePoint Saturday—The Conference

Page 2: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference Welcome to SharePoint Saturday—The Conference

• Please turn off all electronic devices or set them to vibrate.• If you must take a phone call, please do so in the hall so as not

to disturb others.• Open wireless access is available at SSID: SPSTC2011• Feel free to “tweet and blog” during the session• Thanks to our Diamond and Platinum Sponsors:

Thank you for being a part of the first SharePoint Saturday conference

Page 3: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

About Me• Practice Manager with Intellinet• Microsoft SharePoint Server MVP• Dev and Architect with MS stack since 1996• Working with SharePoint since 2002• Raleigh-Durham, NC Area since 1998

Page 4: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Outline & Agenda• Approach and Goals• Overview on Creating Custom Actions• Example 1 – Budget Approval Limits• Example 2 – Out of Office Delegation• Additional Examples• Wrap-up and Questions

Page 5: Spstc2011   Developing Reusable Workflow Features

APPROACH AND GOALSDeveloping Reusable Workflow Features

Page 6: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Approach and Goals• Common Workflow Limitations– Workflows developed one at a time– Config and Admin content is localized – Silos– Maintaining data difficult, and process admin

focused

Page 7: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Approach and Goals• Reuse Goals– Centralize common configuration data– Leverage central farm services– Make it easier for users to maintain their data– Reduce time to create new workflows– Improve efficiency of managing workflows

Page 8: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Approach and Goals• Approaches– Take a “Portfolio Approach” to process design– Change data lookup sources from local to central• Budget Approval Limit example• Out of Office Delegation example

– Group common calls into Actions or Services• Out of Office Delegation example• Check Request example

Page 9: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Approach and Goals• Approaches– Leverage central services like User Profiles, BCS• Budget Approval example• Out of Office Delegation example

– Link workflows together; start workflow from another• Check Request example

Page 10: Spstc2011   Developing Reusable Workflow Features

CREATING CUSTOM ACTIONSDeveloping Reusable Workflow Features

Page 11: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Full Trust Actions• Approaches– Leverage central services like User Profiles, BCS• Budget Approval example• Out of Office Delegation example

– Link workflows together; start workflow from another• Check Request example

Page 12: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Full Trust Action Implementation• Important Namespaces– System.Workflow.ComponentModel– Microsoft.SharePoint.Workflow– Microsoft.SharePoint.WorkflowActions

• Key Dev Tasks– Define Properties– Override ActivityExecutionStatus Execute– Override ActivityExecutionStatus HandleFault– Create WorkflowActions definition in Elements.xml

Page 13: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Sandbox Actions• Developed in Visual Studio• Limited to Site Collection boundaries• Does not require server admin to deploy;

O365• Provides a way to create simple reusable

features

Page 14: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Sandbox Action Implementation• Important Namespaces– Microsoft.SharePoint.Workflow– Microsoft.SharePoint.UserCode

• Key Dev Tasks– Action must return a Hashtable– Action must accept a SPUserCodeWorkflowContext as

the first argument– Create WorkflowActions definition in Elements.xml

Page 15: Spstc2011   Developing Reusable Workflow Features

BUDGET APPROVAL LIMITSDeveloping Reusable Workflow Features

Page 16: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Budget Approval Overview• A common example of data needed to support

an approval workflow• Centralize the data so that it is available for

multiple processes• Leverage services like User Profile and BCS

Page 17: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Bad ApproachLoad Budget For Approver Issues:

• 3 Sites, separate config lists• Separate Maintenance• Out of Sync

Page 18: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Alternative ApproachAdvantages:• Central Source• Can Sync (BCS)• Distributed Management

Page 19: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Demo

Page 20: Spstc2011   Developing Reusable Workflow Features

OUT OF OFFICE DELEGATIONDeveloping Reusable Workflow Features

Page 21: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Out of Office Delegation Overview• SharePoint has built-in Out of Office

Delegation• Great example of User Maintained config data• Great example of leveraging User Profiles

Page 22: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Bad Approach• Building it into each process, with localized

data stored in a list on the workflow site– Process Admin Maintains it– Data stored in multiple places– Workflow steps maintained in multiple places

Page 23: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Alternative Approach• Out of Office Delegation Feature– User Profile Custom Attributes• Out of Office Start Date• Out of Office End Date• Out of Office Delegation

– Custom Workflow Action• Simplifies check from SPD workflows

Page 24: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Demo

Page 25: Spstc2011   Developing Reusable Workflow Features

ADDITIONAL EXAMPLESDeveloping Reusable Workflow Features

Page 26: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Additional Examples• Standard Feature Requests– Escalations– Task Reminders– Role Based Assignments (CFO, Ops Mgr, etc)

• Frequent Re-usable Processes– Check Request– Compliance Activity Logging

Page 27: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Initiating Another Workflow• Create Reusable Sub-Processes• Use Standard Events– New Item– Edit Item

• Can use Full Trust Actions to add/edit items between site collections

Page 28: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Check Request Overview• Check Request is an example of a process that

may be initiated from multiple processes• Could be built into each process, or separated

into a separate “sub-process” for reuse

Page 29: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Bad ApproachIssues:• Same process steps• AP users have tasks in x sites• Multiple places to update if process

changes• Process owners may not

understand other uses

Page 30: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Sub-Process ApproachAdvantages:• Std process on AP site• Easy access for AP users• Easy to maintain and monitor

Page 31: Spstc2011   Developing Reusable Workflow Features

WRAP-UPDeveloping Reusable Workflow Features

Page 32: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Recommended Approaches• Take a “Portfolio Approach” to process design• Change data lookup sources from local to central• Group common functions or calls into Actions or

Services• Leverage central services like User Profiles, BCS• Link workflows together; start workflow from

another

Page 33: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Questions?

Page 34: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Additional Resources• MSDN – Create a Sandbox Workflow Action

– http://msdn.microsoft.com/en-us/library/ff798499.aspx

• MSDN – Reference Implementation Workflow Activities– http://msdn.microsoft.com/en-us/library/ff798330.aspx

• User Profiles – Creating Custom Properties– http://www.mikeoryszak.com/sharepoint/user-profiles-%e2%80%93-creating-custom-properti

es

• User Profiles – Driving Business Process– http://www.mikeoryszak.com/sharepoint/user-profiles-%e2%80%93-driving-business-process

• Workflow Posts– http://www.mikeoryszak.com/tag/workflow

Page 35: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Contact Info• Blog - http://www.mikeoryszak.com• Twitter - @Next_Connect• Email – [email protected]• LinkedIn - http://www.linkedin.com/in/michaeloryszak

Page 36: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Thanks to Our Other Sponsors!Thanks to our Sponsors

Page 37: Spstc2011   Developing Reusable Workflow Features

Welcome to SharePoint Saturday—The Conference

Session EvaluationPlease complete and turn in your Session Evaluation Form so we can improve future events. Survey can

be filled out at:

http://app.fluidsurveys.com/surveys/spstc2011- and add the Session number to the URL

Presenter: ______________________Session Name: ______________________Session No.: ______________________