Master Data Services 2012 and SharePoint WorkFlow

    General discussion

  • During a discussion on this thread, we have discovered than MDS 2012 doesn't fire SharePoint WorkFlow with the Master Data Services  Workflow Windows Service (Microsoft.MasterDataServices.Workflow.Exe)

    The SharePoint WorkFlow Extender :

    Since i need making a SharePoint Workflow with MDS 2012, i have create the extender for SharePoint.

    You can get the source code from the extender here : SharePointExtenderForMDS2012

    By The Way, if you know how works an extender for MDS 2012, here is the code for the extender (included in the Project i have linked)

    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Xml;
    using System.Xml.Linq;
    using Microsoft.MasterDataServices.WorkflowTypeExtender;
    namespace Sharepoint.WorkflowExtender
    public class SPWorkflow : IWorkflowTypeExtender
    public void StartWorkflow(string workflowType, System.Xml.XmlElement dataElement)
    var doc = XDocument.Parse(dataElement.OuterXml);
    Dictionary<string, object> strs = new Dictionary<string, object>();
    var externalAction =
    from e in doc.Elements()
    select new
    Type = (string)e.Element(« Type »),
    SendData = (string)e.Element(« SendData »),
    Action_ID = (string)e.Element(« Action_ID »),
    Server = (string)e.Element(« Server_URL »),
    Model_ID = (int)e.Element(« Model_ID »),
    Model_Name = (string)e.Element(« Model_Name »),
    Entity_ID = (int)e.Element(« Entity_ID »),
    Entity_Name = (string)e.Element(« Entity_Name »),
    Version_ID = (int)e.Element(« Version_ID »),
    Member_ID = (int)e.Element(« Member_ID »),
    MemberData = new
    Name = (string)e.Element(« MemberData »).Element(« Name »),
    Code = (string)e.Element(« MemberData »).Element(« Code »),
    Attributes = e.Element(« MemberData »).Elements().ToDictionary(ae => ae.Name, ae => ae.Value)
    var member = externalAction.MemberData;
    DispatchSPWorkflow(externalAction.Server, externalAction.Action_ID, dataElement, strs);
    catch (Exception)
    private static void DispatchSPWorkflow(string serverUrl, string workflowName, XmlNode dataElement,
    Dictionary<string, object> sites)
    SPSite sPSite;
    SPWorkflowAssociation sPWorkflowAssociation;
    object obj = null;
    if (sites.TryGetValue(serverUrl, out obj))
    sPSite = (SPSite)obj;
    sPSite = new SPSite(serverUrl);
    sites[serverUrl] = sPSite;
    SPWeb sPWeb = sPSite.OpenWeb();
    SPWorkflowManager workflowManager = sPSite.WorkflowManager;
    foreach (SPWorkflowAssociation workflowAssociation in sPWeb.WorkflowAssociations)
    if (!(workflowAssociation.Name == workflowName) || !workflowAssociation.AllowManual)
    sPWorkflowAssociation = workflowAssociation;
    if (sPWorkflowAssociation != null)
    workflowManager.StartWorkflow(null, sPWorkflowAssociation, dataElement.OuterXml, 1);

    As always, this code is provided "as is" :)

    You have (sorry in french) the explanation here : Master Data Services 2012 and SharePoint WorkFlow - Part 1

    A complete Solution :

    To make a complete a solution, which contains the Extender and a WorkFlow Sample, i create a second blog post who explain all the tasks to achieve this goal.

    You can get the full source code (Extender AND Workflow project) here : SharePointExtenderForMDS2012AndWorkFlow

    And by the way, you ll have explanations (again in french :)) here : Master Data Services 2012 and SharePoint WorkFlow - Part 2

    Sébastien Pertus. Bewise

    Tuesday, July 17, 2012 3:28 PM

All replies

  • Sebastien, there are a couple of details I didn't understand in your solution, but the main point is, this solution assumes that MDS is installed in the same server as SharePoint, is that correct?

    Heidl Technologies

    Friday, October 12, 2012 6:51 AM
  • I have developed a workflow extender which does not required MDS to be installed in the same server, contact me if you're interested. 

    Half Scheidl

    Thursday, November 22, 2012 7:10 AM
  • Ok, I developed three components to make the MDS-SharePoint integration better.

    Please check the codeplex project

    Half Scheidl

    Sunday, June 2, 2013 12:10 PM