In The Mix

As a SharePoint architect I have the business behind me and the Developers and IT Pro on my shoulders.

Lazy Workflow Approval in SharePoint March 17, 2009

Filed under: SharePoint — fmuntean @ 3:32 pm

I was asked about a “Lazy Approval” for a project in SharePoint.

First let’s define what “Lazy Approval” means: The user should be able to use their mobile phones to approve SharePoint tasks that were spawned by a SharePoint workflow.

Now that being said we have the problem defined, so let’s see the solution that I came up with to solve this problem:

  • The workflow processes a task as follow: Create new Task -> while not completed -> Wait for update -> process the properties in principal the outcome -> if completed -> then complete the task.
  • A task gets created for a person and the user can edit it to approve/reject
  • We can add an event listener on the tasks list and send a special email to the user. the email needs to be less than 1Kb and should contain the instructions on how the approve/reject the item by email. it will also  contain an hidden <div id=”LazyApproval”>  that contains all the necessary data to identify the task as the URL to the task and maybe the GUID. The ‘from’ field of the email address should contain a special email address.
  • Create a library to store the incoming emails from the Lazy Approval. Attach an event receiver to it that will process the messages and update the tasks list with the outcome given by the user. here we can put some validation and if we can’t process the message to update the task we can send another email to the user or a confirmation one when the task got updated.
  • Once the task got changed the workflow will see the change and continue.

By using the described approach the user has the choice of approving using SharePoint or by email using the reply button and writing the outcome.

This approach will work with any existing out of the box or custom workflow and is reusable.

There are few issues that needs to be iron out:

  • If the task list is used for other task types as review then we need to use a content type for the approver task and attach the event handler to it thus making the solution apply only to a custom workflow that use the custom task content type.
  • The user want to see more data other than the task title in the Lazy Approval email.
Advertisements
 

11 Responses to “Lazy Workflow Approval in SharePoint”

  1. Joe Says:

    This is a great idea!

    I find it shocking that MS doesn’t streamline more of this type of functionality into their SP services. One would think that MS understands the needs of executives who do not have regular access to a PC, or Internet Explorer and need to do everything via mobile devices.

    I’m having good success implementing this solution, although I am having a bit of trouble accessing the information within the email body.

    Thanks for this great post!

  2. Polina Says:

    Hi,

    I am building a Lazy Approval workflow with SharePoint Designer.
    I attach a workflow to the approval task list that sends an email from a special address to the task assignee. The email contains the task ID. When they reply, the email goes to another list and starts a worflow that updates the task in the first list.

    How do you get the task ID from the email body?

    Thank you,
    Polina

  3. fmuntean Says:

    Hi Polina,

    If you are using this approach then the items in the second list will/should contain eml files.
    You will need to read those files and parse them in memory to get the outcome and the TaskID.
    Another way to do this is to generate an ID (not a guid) and put it in the subject line. You will need to store that ID somewhere so you can get to it later when receiving the email back. This will make the identification easier as you can use the Title property of the item.

    Hope this helps and let me know how it works for you,
    Florin

  4. Tarek Jajeh Says:

    why email should be less than 1 KB ?!

    may u publish a sample code of this and also of the Task Reassignment post (https://fmuntean.wordpress.com/2009/06/26/sharepoint-workflow-task-reassignment/)

  5. blackpsyco Says:

    I’m using sharepoint 2007, develop a form library. the form needs an approval after it’s created.
    one form has more than one approver, its working sequentially on workflow. every approver will get a notification email.

    I’m wandering if it is possible to put the approval button on email body?
    so the approver could response directly on his/her email without open the form on browser.
    or is there any other solutions that can help me to deliver this problem of mine?
    need your help! or my boss will kill me!

  6. shazy Says:

    Hi
    Is this possible in SP 2010?

  7. george hardy Says:

    hi all:
    i would like to chime-in on this one. I recently did my own lazy approval system in SP2010, and have outlined exactly how to do it in three easy steps:

    http://realworldsharepoint.wordpress.com

  8. fmuntean Says:

    Yes

  9. fmuntean Says:

    Great work.

  10. Dilip kampa Says:

    Hello there, my organz recently bought Nintex workflows and started working on it. we created basic WF taking random document library for a test. So in the workflow we have given approve/reject step. So any changes made WF tiggers. When I tried to reply approve from my mobile device. I get the following error “5.1.2 – Bad destination host ‘DNS Hard Error looking up Server.domain. (MX): NXDomain’. Any idea how to approve through mobiles. (Lazy Approval WF)

  11. fmuntean Says:

    From the error message looks like the incoming email feature is not enabled correctly. To be more precise it says in the error that an MX record was not found for that email destination.
    There are instructions in the Nintex installation document on how to enable incoming emails.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s