#GPPT Ensuring Custom Triggers Cannot Be Disabled

David Meego - Click for blog homepageIf you are using GP Power Tools in your Microsoft Dynamics GP system and have the Developer Tools module registered you can use the custom trigger in this article to ensure that GP Power Tools triggers cannot be disabled using the Customization Status window.

This will protect mission critical customizations written using GP Power Tools with triggers from being disabled manually.

Introduction

The Customization Status window is part of the runtime engine but can be controlled by standard application-level security. Based on the default Security Tasks and Security Roles, access to the Customization Status is limited to the POWERUSER and IT OPERATIONS MANAGER* roles as well as the GP Power Tools created SUPERUSER role.

Note: The GP Power Tools Dictionary Control window has similarities to the Customization Status window but can also remember settings between sessions and can also control access to Modified and/or Alternate windows. Disabling GP Power Tools triggers from this window is prevented so we don’t need to worry about this window.

If you want to allow access to the Customization Status window but want to ensure that GP Power Tools cannot be disabled, adding the following trigger will satisfy that requirement.

Creating the Trigger

As the trigger has to be written against the Customization Status window, which is part of the runtime engine, you will need add the following Dex.ini setting:

MBS_Debug_ShowRuntime=TRUE

Then you can open Trigger Setup and create the trigger. See the screenshots and information below for the settings:

Create the trigger using the following settings:

Trigger ID: CUSTOM_STATUS
Trigger Description: Prevent GPPT Triggers being disabled
Start Trigger Automatically on Login: Checked
Do not activate Logging Mode: Checked
Minimize Log Entries (Error Only): Checked
Trigger Type: Focus Event
Trigger Event: Scroll Pre
Trigger Attach: After Original

On the Resource Tab select the following:

Product Name: 1: DEX.DIC
Form Name: ‘View Product Triggers’
Window Name: ‘Product List’

On the Script Tab enter the following:

Script in Dictionary context of 1: DEX.DIC

out boolean OUT_Condition;

OUT_Condition = false;

if isopen(form 'View Product Triggers') then
if 'Product Name' of window 'Product List' of form 'View Product Triggers' = Launch_GetProdName(5261) then
disable '(L) Disable' of window 'View Client-Side Triggers' of form 'View Product Triggers';
end if;
end if;

Checking the Result

Logging in again or using the GP Power Tools Logging Control window to start the trigger and going back to the Customization Status window shows how the Disable Button is disabled for the GP Power Tools product preventing it from being disabled.

PS: You could add the trigger to a project if you want to make it simpler to start and start the trigger or export and import the trigger.

More Information

Also see this article about Mission Critical Code:

Hope this is useful.

David

This article was originally posted on http://www.winthropdc.com/blog.

One thought on “#GPPT Ensuring Custom Triggers Cannot Be Disabled

Please post feedback or comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.