SQL Scripts for Microsoft Dynamics GP: SQL Function To Return Approver

Microsoft Dynamics GPThis script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posting the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.

This script will return the approver of a workflow. It complements two other functions which I have previously posted:

IF OBJECT_ID (N'uf_AZRCRV_GetWorkflowApprover', N'FN') IS NOT NULL
    DROP FUNCTION uf_AZRCRV_GetWorkflowApprover
GO
CREATE FUNCTION [dbo].[uf_AZRCRV_GetWorkflowApprover](@WorkflowTypeName CHAR(50),@WfBusObjKey CHAR(20))
	RETURNS VARCHAR(50)
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). */
/* Author: Ian Grieve Version: 1.0 Date: 1/3/2017 Returns Workflow Approval status of a specified workflow item. Requires parameters of WorkflowTypeName and WfBusObjKey Valid Workflow Type Names are (as of Microsoft Dynamics GP 2016 R2): General Ledger Batch Approval Receivables Batch Approval Payables Batch Approval Payables Transaction Approval Purchase Order Approval Purchase Requisition Approval Vendor Approval Employee Profile Approval Employee Skills Approval Payroll Direct Deposit Approval Payroll Timecard Approval Payroll W4 Approval Expense Report Approval Timesheet Approval Smartlist Designer View Approval */ BEGIN RETURN ISNULL(( SELECT TOP 1 WFU.ADDisplayName FROM WF30100 AS WF --Workflow History (WF30100) INNER JOIN WFI10002 AS WFI --Workflow Instance Master (WFI10002) ON WFI.WorkflowInstanceID = WF.WorkflowInstanceID INNER JOIN WF40200 WFU --Workflow Users (WF40200) ON WFU.ADLogin = WF.Workflow_History_User WHERE WFI.Workflow_Type_Name = @WorkflowTypeName AND WFI.WfBusObjKey = @WfBusObjKey AND WF.Workflow_Action IN (3) --APPROVED ORDER BY WF.DEX_ROW_ID DESC) ,'') END GO GRANT SELECT ON uf_AZRCRV_GetWorkflowApprover TO DYNGRP GO

Click to show/hide the SQL Scripts for Microsoft Dynamics GP Series Index

New book on Jet Reports with Microsoft Dynamics 365 Business Central available

Microsoft Dynamics 365 Business CentralI have a new book available now called Jet Reports with Microsoft Dynamics 365 Business Central; this book is aimed at end-users or consultants looking to use Jet Reports with Microsoft Dynamics 365 Business Central for financial and/or operational reporting.

The book covers the basics of installing and configuring Jet Reports as well as how to design and build reports using the Excel Add-in, before moving on to step-by-step guides on creating six different types of report and closing with a look at the report building tools, Jet Hub and report distribution.

Jet Reports with Microsoft Dynamics 365 Business Central by Ian Grieve

The book is available as an eBook direct from my azurecurve Publishing site or from Amazon (for $5 more):

The book is structured into these chapters:

  • Chapter 1, Introduction to Jet Reports, introduces Jet Reports and explains what type of reporting for which it can be used.
  • Chapter 2, Implementing Jet Reports, covers the installation of Jet Reports including the Jet Service Tier and Jet Hub.
  • Chapter 3, Configuring Jet Reports, shows how to configure Jet Reports once it has been installed.
  • Chapter 4, Introducing the Excel Add-in, introduces the Excel Add-in and the features available.
  • Chapter 5, Report Structure, shows how reports can be structured to make maintaining them easier.
  • Chapter 6, Using the functions in the Excel Add-in, shows how each of the four Jet Functions can be used.
  • Chapter 7, Creating and using an Options page, covers the creation and use of an options page in reports.
  • Chapter 8, Create a Summary Trial Balance, steps through the creation of a Summary Trial Balance report.
  • Chapter 9, Create a Detailed Trial Balance, shows how to make the Summary TB from the previous chapter into a Detailed report.
  • Chapter 10, Create a Balance Sheet, covers the creation of a formatted Balance Sheet.
  • Chapter 11, Create an Income Statement, covers the creation of an Income Statement and how to make it an intercompany/consolidated version.
  • Chapter 12, Create a Summary Payables Aged Trial Balance, shows how to create a Summary Payables Trial Balance report.
  • Chapter 13, Create a Sales Invoice by Customer Report, covers the creation of an operational report on sales invoices.
  • Chapter 14, Report Creation Tools, introduces the tools which can be used to make creating reports easier.
  • Chapter 15, Using Jet Hub, shows how users can access Jet Reports via web access and without a local install of Jet Reports.
  • Chapter 16, Report Distribution, shows how users can schedule or generate reports into Microsoft Word.

If you buy the ebook from me directly, the coupon code JetWithBCLaunch will get you 20% off the price of this book (offer available until the end of June 2023).