Support Debugging Tool Customization #11 – Restricting Salesperson ID for Existing Customers

| 03/13/2012 | 1 Comment

Recently there was a support request in the forum,

http://social.microsoft.com/Forums/en-US/partnerdynamicsgp/thread/139b760a-5c63-4b16-b480-79f0a569075c

where the requirement was as below.

We want to modify the Customer Maintenance window to make the Salesperson ID field uneditable for existing records only.  I went into Modifier and made this field uneditable but that makes it uneditable each time the window opens.  We want the field to be available when creating a new customer – we just don’t want users to be able to change that field for existing customers.

In this article, I am going to post the details of how this customization can be achieved using Support Debugging Tool.

Version Information

Dynamics GP : 11.0.1914 (SP2)

Support Debugging Tool : 11.00.0016

Screenshots of the Configuration

Trigger #1 – Resource Tab

image

This is a trigger on the Display Existing Record Change – After Original on the Customer Maintenance window. This trigger will check if both the Customer Number and the Salesperson ID fields are populated with data, and if these fields are populated with values, we will lock the Salesperson ID field and disable the corresponding lookup button for the Salesperson ID field.

Trigger #1 – Customization Script

in string IN_OldValue;
in string IN_NewValue;
out boolean OUT_Condition;
 
OUT_Condition = false;
 
if isopen(form RM_Customer_Maintenance) then
	if not empty('Customer Number' of window 'RM_Customer_Maintenance' of form 'RM_Customer_Maintenance') and 
		not empty('Salesperson ID' of window 'RM_Customer_Maintenance' of form 'RM_Customer_Maintenance') then
		lock field 'Salesperson ID' of window 'RM_Customer_Maintenance' of form 'RM_Customer_Maintenance';
		disable field 'Lookup Button 6' of window 'RM_Customer_Maintenance' of form 'RM_Customer_Maintenance';
		OUT_Condition = true;
	else
		unlock field 'Salesperson ID' of window 'RM_Customer_Maintenance' of form 'RM_Customer_Maintenance';
		enable field 'Lookup Button 6' of window 'RM_Customer_Maintenance' of form 'RM_Customer_Maintenance';
		OUT_Condition = true;
	end if;
end if;

Trigger #2 – Resource Tab

image

This is a trigger on the Display Existing Record Change – After Original on the Customer Address Maintenance window. This trigger will check if the Customer Number, Address Code and the Salesperson ID fields are populated with data, and if these fields are populated with values, we will lock the Salesperson ID field and disable the corresponding lookup button for the Salesperson ID field.

Trigger #2 – Customization Script

in string IN_OldValue;
in string IN_NewValue;
out boolean OUT_Condition;
 
OUT_Condition = false;
 
if isopen(form RM_Customer_Address) then
	if not empty('Customer Number' of window 'RM_Customer_Address' of form 'RM_Customer_Address') and 
		not empty('Address Code' of window 'RM_Customer_Address' of form 'RM_Customer_Address') and
		not empty('Salesperson ID' of window 'RM_Customer_Address' of form 'RM_Customer_Address') then
		lock field 'Salesperson ID' of window 'RM_Customer_Address' of form 'RM_Customer_Address';
		disable field 'Lookup Button 8' of window 'RM_Customer_Address' of form 'RM_Customer_Address';
		OUT_Condition = true;
	else
		unlock field 'Salesperson ID' of window 'RM_Customer_Address' of form 'RM_Customer_Address';
		enable field 'Lookup Button 8' of window 'RM_Customer_Address' of form 'RM_Customer_Address';
		OUT_Condition = true;
	end if;
end if;

Configuration File Location

You can download the configuration for this requirement here.

Reference

Take a look at the article below which summarizes the usage of Support Debugging Tool with some real life examples. Great compilation by David! http://blogs.msdn.com/b/developingfordynamicsgp/archive/2011/08/05/using-the-support-debugging-tool-with-real-life-examples.aspx

You can get more details about the Support Debugging Tool at http://aka.ms/SDT

Hope this helps the community…

Until next post!

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Tags: , , , , , ,

Category: Accounts Receivables, Customizations, Dynamics, Great Plains, Support Debugging Tool

About the Author ()