spMFProcessBatch_Mail

Signature

EXEC dbo.spMFProcessBatch_EMail
    @ProcessBatch_ID = 0,
    @RecipientEmail = NULL,
    @RecipientFromMFSettingName = NULL,
    @ContextMenu_ID = NULL,
    @DetailLevel = 0,
    @LogTypes = NULL,
    @Debug = 0;

Returns

INT: 1 on success; -1 on error.

Parameters

@ProcessBatch_ID
  • Type: INT

  • Required: Yes

  • Description: ID from /tables/tbMFProcessBatch to include in the email.

@RecipientEmail
  • Type: NVARCHAR(255)

  • Required: No

  • Description: Email address to send to. When NULL, uses MFSettings(Name=’SupportEMailProfile’).

@RecipientFromMFSettingName
  • Type: NVARCHAR(128)

  • Required: No

  • Description: MFSettings.Name key to append additional recipients; used with or without RecipientEmail.

@ContextMenu_ID
  • Type: INT

  • Required: No

  • Description: When provided, recipient is derived from Context Menu ‘Last Executed By’ user.

@DetailLevel
  • Type: INT

  • Required: No (default = 0)

  • Description: 0 = Summary only; 1 = include MFProcessBatchDetail filtered by LogTypes.

@LogTypes
  • Type: NVARCHAR(200)

  • Required: No

  • Description: Comma-separated LogTypes to include when DetailLevel = 1.

@Debug
  • Type: INT

  • Required: No (default = 0)

  • Description: 1 = Standard debug.

Purpose

To email MFProcessBatch and MFPRocessBatch_Detail along with error checking results from spMFCreateTableStats

Additional Info

This procedures calls spMFResultMessageForUI. The latter procedure formats the email body.

Setting the Detail level to 1 and defining the logTypes to ‘Status’ show extended details for processing.

Prerequisites

When DetailLevel is set to 1 then logtype need to be specified.

Examples

Show the Records in MFProcessBatch and MFProcessBatchDetail

SELECT * FROM dbo.MFProcessBatch AS mpb
INNER JOIN dbo.MFProcessBatchDetail AS mpbd
ON mpbd.ProcessBatch_ID = mpb.ProcessBatch_ID
WHERE mpb.ProcessBatch_ID = 3

Email with summary detail sent to email defined in MFSettings SupportEMailProfile

EXEC spMFProcessBatch_EMail
@ProcessBatch_id = 191,
    @Debug = 0

Email with more detail on the processing steps

EXEC spMFProcessBatch_EMail
@ProcessBatch_id = 191,
@DetailLevel = 1,
@Logtypes = 'Status',
    @Debug = 0

Changelog

Date

Author

Description

2021-02-25

LC

Showing processbatch detail with

2017-12-28

LC

Allow for messages with detail from ProcessBatchDetail

2017-11-24

LC

Fix issue with getting name of MFContextMenu user

2017-10-03

LC

Add parameter for Detaillevel, but not yet activate. Add selection of ContextMenu user as email address.

2017-02-01

AC

Create procedure