11.01.2010: A follow-up on this article is posted here: Check workflow status and refresh page when status equals “Completed”
Have you ever wanted to prevent editing of a list item if the workflow has failed? Here is the answer.
This code queries the list trough the web-service lists.asmx to get the status of the workflow. If the status i “3” – the workflow has failed and we want to prevent further editing of the element until the issue is resolved (the workflow is aborted and the cause is identified).
As always we start like this:
The jQuery-library is found here. The pictures and the sourcecode refers to jquery-1.3.2.min. If you download another version, be sure to update the script reference in the sourcecode.
The scripts “interaction.js” and stringBuffer.js” is created by Erucy and published on codeplex – you can find them here.
Find your list’s GUID and edit the script below and change the listGuid (line 18) and the “FieldInternalName” of your “Workflow-column” (line 18 and 20).
Add a CEWP below your EditForm like this:
With this code: (change listGuid and Wf’s “FieldInternalName”)
Please ask if something is unclear.