SQL View to return Microsoft Dynamics GP Workflow step approvers

Microsoft Dynamics GPI was recently talking to a client who was looking at creating a SQL script which they could run for the auditors which shows the assigned approvers to the steps of a Microsoft Dynamics GP Workflow process.

I’d written similar code for others before so I was able to provide them with this view:

CREATE VIEW uv_AZRCRV_GetWorkflowSetupStepAssignment AS
/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
SELECT ['Workflow Master'].Workflow_name ,['Workflow Master'].Workflow_Description ,CASE WHEN ['Workflow Master'].ACTIVE = 1 THEN 'Yes' ELSE 'No' END AS ACTIVE ,['Workflow Step Instance Table'].WF_Step_Predecessor ,['Workflow Step Instance Table'].Workflow_Step_Name ,['Workflow Step Instance Table'].WF_Step_Description ,['Workflow Step Instance Table'].EmailMessageID ,['Workflow Users'].ADLogin ,['Workflow Users'].ADDisplayName FROM WF100002 AS ['Workflow Master'] LEFT JOIN WF100003 AS ['Workflow Step Instance Table'] ON ['Workflow Step Instance Table'].Workflow_Name= ['Workflow Master'].Workflow_Name LEFT JOIN WF40200 AS ['Workflow Users'] ON ['Workflow Step Instance Table'].Workflow_Step_Assign_To = ['Workflow Users'].UsersListGuid GO

This can be deployed to a company database and a SmartList object created using either SmartList Designer or SmartList Builder.

Updated 27/2/2020 to add Active column

What should we write about next?

If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.

Your Name

Your Email

Suggested Topic

Suggestion Details

Looking for support or consultancy with Microsoft Dynamics GP?

I no longer work with Microsoft Dynamics GP, but the last company I worked for was ISC Software in the UK; if you’re looking for support or consultancy services with Microsoft Dynamics GP you can contact them here.

3 thoughts on “SQL View to return Microsoft Dynamics GP Workflow step approvers

  1. Peter Burton says:

    Hey Ian,

    May I suggest you expand this to include the Workflow Master table (WF100002) to restrict the query to only show active workflows as this query will show all of the historical workflow steps, which could be confusing as the business logic is expanded over time.

    I updated the SQL select to include this but it’s too large for the comment section so I have put this in Pastebin: https://pastebin.com/pMvEQnEP

    1. Ian Grieve says:

      Hi Peter,

      I’ve added the Active flag as a column returning Yes or No; this allows people to filter the returned workflows to only thr active ones if they want, while also allowing them to review workflows being built, but not yet active.

Leave a Reply

Your email address will not be published. Required fields are marked *