locked
How to call custom workflow from business rule? RRS feed

  • Question

  • I'm following tutorial of https://docs.microsoft.com/en-us/sql/master-data-services/develop/create-a-custom-workflow-master-data-services and successfully SQL Server 2016 MDS Workflow Integration Service is up and running and next task is to create business rule.

    1) I have created first basic business rule and published it to SQL Server 
    2016 MDS. This rule works fine!

        `If version contains 10
        Then text equals 10
        Else None`

    2) I have then created business rule to call workflow, but nothing happens (checked from Service Broker/System Queue) 

        `If
        version contains 10
        Then
        version start workflow mdsserver/MDS MdsWorkflowTrigger WFID False
        Else
        None`
        
    This is in workflow.exe.config:

            `<setting name="WorkflowTypeExtenders" serializeAs="String">  
                <value>WFID=MdsWorkflowTrigger.MdsWorkflowTrigger, 
             MdsWorkflowTrigger</value>  
             </setting>`

    Kenny_I

    Tuesday, July 4, 2017 1:22 PM

All replies

  • Try to troubleshoot and find out if there are any exceptions raised in the custom assembly. Please follow below steps for debugging.

    Troubleshooting

    When configuring Master Data Services to work with a workflow, you might encounter any of the following issues.

    The Workflow Handler Doesn’t Receive Data


    If the workflow handler doesn’t receive data, you can try debugging the workflow service or viewing the Service Broker queue to determine if the correct data is still in the queue.

    Debug the Workflow Service

     

     

    1. Stop the service if it is running.

    2. Open a command prompt.

    3. Go to the location of your service and run the service in console mode by typing: Microsoft.MasterDataServices.Workflow.exe -console

    4. Press ENTER.

    5. In Master Data Manager, update your attribute and apply business rules again. Detailed logs are displayed in the console window.

    View the Service Broker Queue

     

     

     

    The Service Broker queue that contains the master data passed as part of the workflow is: mdm.microsoft/mdm/queue/externalaction. This queue can be found in SQL Server Management Studio by opening the Master Data Services database in Object Explorer, then opening Service Broker and Queues. Right-click the queue and select Select Top 1000 Rows to view the top 1000 rows in the queue.

    If the service cleared the queue properly, this queue should be empty.

    If there is data in the queue that you want to remove, you can run the following SQL script to clear the queue. You must change myDatabase to the name of your Master Data Services database.

    declare @conversation uniqueidentifier
    while exists (select 1 from [myDatabase].[mdm].[microsoft/mdm/queue/externalaction])
    begin
    set @conversation = (select top 1 conversation_handle from [myDatabase].[mdm].[microsoft/mdm/queue/externalaction] )
    end conversation @conversation with cleanup
    end

    • Marked as answer by Kenny_I Wednesday, July 5, 2017 2:10 PM
    • Unmarked as answer by Kenny_I Thursday, July 6, 2017 9:44 AM
    Wednesday, July 5, 2017 1:15 AM
  • I don't see data in externalaction queue.  What does following Dispatching using extender mean? Does it mean that workflow was called successfully? How do see if dll was real called and its possible errors? 

    Running in console mode. Press ENTER to exit.

    Loading workflow type extenders. For test purposes you may use: Microsoft.MasterDataServices.Workflow.WorkflowTypeTest, Microsoft.MasterDataServices.Workflow, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91

    Loading workflow type extender: WFID=MdsWorkflowTrigger.MdsWorkflowTrigger, MdsWorkflowTrigger

    Loaded workflow type extender for: WFID

    Testing database connection.

    Database connection successfully tested.

    [07/06/2017 11:37:52] Workflow MdsWorkflowTrigger on ServerName

    Dispatching using extender: WFID


    Kenny_I

    Thursday, July 6, 2017 9:44 AM
  • Yes it means the custom assembly was called. If there are any exceptions raised in dll it should appear in the console window.

    Did you get any exceptions in the console window after the line Dispatching using extender: WFID?

    If no exceptions raised and no action was taken then you need to check if you have used the correct node from the XML element. It will be good if you can share the DLL code to find out what could be the issue.

    Thanks,

    Gayatri

    

    Thursday, July 6, 2017 11:18 PM