samedi 20 septembre 2014

Get workflow task related item

  SPList list = null;
var relativeUrl = SPContext.Current.Web.ServerRelativeUrl.Equals("/") ? string.Empty : web.ServerRelativeUrl;

                list = SPContext.Current.Web.GetList(string.Concat(relativeUrl, "/Lists/", listname));
                list = SPContext.Current.Web.GetList(string.Concat(relativeUrl, "/", listname));

list .commandesList.GetItemById(int.Parse( currentItem[SPBuiltInFieldId.WorkflowItemId].ToString()));

vendredi 5 septembre 2014

Remove the default Task Outcomes (Approved rejected)

  • Create a new Task List Instance (new workflow wizard will help you do it)
  • new Custom List Column with type OutcomeChoice

<Elements xmlns="">  
       Group="Custom Site Columns">

      <CHOICE>very goodt</CHOICE>

  • new ContentType Inherit from Workflow Task (SharePoint 2013)  (we will edit this later)
  • Add the Custom Column to the contentType
  • from the contentType Element.xml remove this string  003365C4474CAE8C42BCE396314E88E51F
So an ID like:
0x0108003365C4474CAE8C42BCE396314E88E51F00B237734C3B3E48D38A52DAAA52F56A8F  ==> 0x010800B237734C3B3E48D38A52DAAA52F56A

  • Open the file Workflow.xaml with xml editor 
  • find your <p:SingleTask
  • change ContentTypeId to the new id you just modified (0x010800B237734C3B3E48D38A52DAAA52F56A)
  • go to your TaskList instance and Add your contentType:
  <ContentTypeBinding ListUrl="Lists/InterventionList" RootWebOnly="FALSE" ContentTypeId="0x010800B237734C3B3E48D38A52DAAA52F56A" />
  • Deploy your project and see the magic happens
Please leave a comment if you need clarifications

jeudi 4 septembre 2014

Workflow manager not responding after cumulative update


If you have updated your workflow manager using the cumulative update :

So you probably facing an issue with your workflow manager, right ?

Ok this is how to fix it (it's weird I konw but this works for me)

Open your SQL management studio and run this script in the Sharepoint database

USE WFResourceManagementDB
INSERT INTO WorkflowServiceConfig VALUES('WorkflowServiceScopeSnapshotProcessBatchSize', '50')
INSERT INTO WorkflowServiceConfig VALUES('WorkflowServiceScopeSnapshotProcessLoopInterval', '00:05:00')
INSERT INTO WorkflowServiceConfig VALUES('WorkflowServiceSuspendedInstanceRetentionDuration', '00:30:00')
INSERT INTO WorkflowServiceConfig VALUES('WorkflowServiceMaxInstanceCompressedSizeKB', '5120')

This solution will help you deploy workflows again but you will be facing many other problems. so I recommand to reinstall your workflow manager on a clean Database. (reusing an existing database will not resolve your problems)

so detach your workflow manager from the farm and remove this databases list:

  1. WfManagementDB
  2. SbGatewayDatabase
  3. SBMessagingContainer01
  4. WFInstanceManagementDB
  5. WFResourceManagementDB
  6. SBManagementDB
And then you will be able to have a new workflow manager clean installation.

mercredi 3 septembre 2014

sharepoint 2013 Show Errors (why it's not working for you)

To disable the custom error page in  sharepoint 2013 you have to set  
<customErrors mode="On" /> to <customErrors mode="Off" /> 

Ok but this may not work , right ? I tell you why.

For sharepoint there is many web.config files located under:


but non of them will work as expected for pages using layouts.

To make it work, you must modify the web.config under

"C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS"

Hope it works for you either. 

Sharepoint 2013 & Custom Task Outcome on VisualStudio

This is the how it works:

Add new SiteColumn
Change the Type param value to "OutcomeChoice" in <Field /> tag

Add :   <CHOICES >
                <CHOICE>choice one</CHOICE>
                <CHOICE>choice two</CHOICE>
Add new ContentType  and inherit from Workflow Task (SharePoint 2013)
Add Columns: 
  • % Completed
  • Task Status
  • The custom OutcomeColumn
NB: The order is Important, if the custom Outcome Column is not the last one choices will appear as a DropBox and to as buttons

Add new Task List Instance (Or a Custom list template)

Insure the TemplateType is set to "171" (this Id reference Task template)

If you are working with a Task list Instance Add Schema.xml file to it and copy content from a Task list template (create a new Task list template, copy schema.xml content, modify List Name and URL to match your List Instance )

Deploy and happy to help you.

Please let me know if there is any issue so i can update this article