OOB Approval Workflow error

SP2013


Hello everyone,

Today I’ll talk about a strange moment in the life of SharePoint Consultant. One of those moments where the reaction can only be « WHAAAAAAAAAAAAAAAAAAAT??? ».

 

That moment came when I found myself in front of an error. This error has occurred on a OOB workflow « Approval 2010 ».

This workflow worked properly for weeks when all of a sudden he started not wanting to go on documents submission.

The error message displayed in the « workflow status » was: « The workflow operation failed because the workflow lookup found no matching item ».

With a little searching, I found this msdn link explaining the frequent errors of workflow development: http://msdn.microsoft.com/en-us/library/office/dn449112(v=office.15).aspx#bkmk_error09

I admit I laughed a little reading the passage dealing with the error:

“The workflow operation failed because the workflow lookup found no matching item

This indicates there is an error in the workflow logic. Check to ensure that you are selecting the correct list and field in your lookup.”

(Recall that the workflow is a OOB, so developed by the MS team :p).

 

It’s funny but it does not help me. By analyzing the logs, I found the following error « WinWF Internal Error, terminating workflow Id# »

My research led me to this msdn topic: http://social.msdn.microsoft.com/Forums/en-US/f582ad6b-f3f8-4451-85c1-95d88e953481/ootb-workflow-error explaining that the error appears when you tick the option « Enable Content Approval : Update the approval status after the workflow is completed (use this to control content approval) »

..

“WHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAT ??”

Indeed, by unchecking this option, the approval workflow creates tasks correctly, but does not validate the document. So I ended up using an event « onworkflowcompleted » to validate my document after my approval workflow is finished.

I have now 2 questions:

« Why was it working at first? » and « Why is it not working anymore? »

 

If anyone knows the answer, I’m interested.

Christopher

Use InfoPath form in Workflow


Hi everyone,

Today I’ll talk Workflow with InfoPath , especially the steps needed to attach the form to a task.

Step 1: Creating the module

First start by adding a module called “Forms” in our workflow in order to have a solution that looks like this.

Step 2: Add the InfoPath form to the module

Then create our infopath.

Nothing complicated here, the idea of this article is just to show how to integrate ourcustom form in a SharePoint task.

Once the form is done, a modification of the loan security is necessary, for this we must go the menu “File” – “Form Options”

Here we need to specify security at least on “Domain”.

Once this security in place, publish our form. We will publish it directly into our project.For this we must go to the tab publication and choose to publish on the network.

Select the location of our module “Forms” that we created in our workflow.

The next step is very important, we must empty the link to access our form!

This generates an error message when clicking next, click “OK” to ignore.

Let’s get to publish the form.

Once the form is published, get back to our Visual Studio solution and display all files by clicking the appropriate button.

Do a right click on our infopath to add it to the solution.

We can see in the Elements.xml file thath the form has been automatically added to the module.

Step 3: Edit the “feature.xml”

Now that infopath is added, we must deploy it to our SharePoint environment. For this we must add a specific receiver in the manifest of the feature.



ReceiverAssembly = "Microsoft.Office.Workflow.Feature, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

ReceiverClass = "Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver"

That’s this receiver which will upload the infopath. We must also specify the following property so it knows where to look for forms.



<Property Key="RegisterForms" Value="Forms\*.xsn"/>

In the end we have a manifest that looks like this

Step 4: Edit the workflow’s “Elements.xml” file

We now need the ID of OOB content type “SharePoint Workflow Task InfoPath” in our definition.



<Workflow …

TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160" >

We must also specify the urn of our infopath. Caution! Make sure you have the urn of the published form!



<Task0_FormURN>urn:schemas-microsoft-com:office:infopath:Task1:-myXSD-2012-04-26T13-02-48</Task0_FormURN>

For each form you can specify the ID here the example “<Task0_FormURN>” shows the ID 0, remember this ID we will use it right after!

Ultimately our file “Elements.xml” should look like this

Step 5: Changing the code to create the task.

In our workflow we can now specify the form that we use, for that we must change the properties of the task by giving the ID of the appropriate form, in our example we will give him the ID 0.

Our code looks like this

Step 6: Checking.

After deploying the solution we should find our form in the central administration more precisely in “General Application settings” – “Manage form templates”

And indeed it is present.

By starting our workflow when creating the task we can see our form!

Voila !

Christopher.