Support Debugging Tool Customization #9 – Credit Limit Check Skip in Receivables Transaction Entry (using Native Dexterity Save Logic)

| 11/03/2011 | 8 Comments

Recently there was a support request in the forum,

http://social.microsoft.com/Forums/en-US/partnerdynamicsgp/thread/a3237a4f-fa4c-4603-8048-94cc0b2af467

where the requirement was as below.

Is there anything in Accounts Receivable that will allow a certain type of document (whatever that may be) bypass the Credit Limit Check? My client has a customer with a Credit Limit of $5000.  They are additionally seeking a donation to a Charity from this customer for $10,000.  They do not want the $10,000 invoice to be included in the Credit Limit Calculation.  I know they could temporarily adjust the Credit Limit or they could setup a second Customer but is there any other way to get around the credit Limit in this case?”.

Since this is not an out of the box functionality, it needs to be customized. Assuming that the customer does not want the credit limit check for Debit Memos, the design that I thought of was to update the credit limit information for the customer by setting his credit limit to unlimited, before the credit limit validation procedure is called (taking a backup of the existing values), and once the validation was competed, I will update the original credit limit information back for the customer. This update happened only if the document type was Debit Memos.

I decided to take this up as a Support Debugging Tool task and planned to achieve it using 2 methods.

  • Using native Dexterity code for updating the customer record (using the “save record” command).
  • Using SQL Execute functionality in Support Debugging Tool

Another functionality of SDT which I have explored in this task, is the use of parameter collections in SDT, where we can set the parameters in one procedure in SDT and retrieve them from another procedure, thus explaining the feature of how to pass parameters from one procedure into another using Support Debugging Tool.

In this article, I am going to post the native Dexterity method and how it was achieved.

Version Information

Dynamics GP : 11.0.1752 (SP2)

Support Debugging Tool : 11.00.0015

Screenshots of the Configuration

Trigger #1 – Resource Tab

This is a trigger on the Customer Number Change – After Original on the Receivables Transaction Entry window. This is to capture the customer number and the document type into a parameter. Note the use of “MBS_Param_Set to set the parameter values. You can use the Helper button to select the coding syntax for setting parameter values.

image

Trigger #1 – Customization Script

in string IN_OldValue;
in string IN_NewValue;
out boolean OUT_Condition;
local string MBS_Parameter;
OUT_Condition = false;
if isopen(form RM_Sales_Entry) then
	if 'Document Type' of window 'RM_Sales_Entry' of form 'RM_Sales_Entry' = 2 then
		if not empty('Customer Number' of window RM_Sales_Entry of form RM_Sales_Entry) then
			call with name "MBS_Param_Set" in dictionary 5261,
				"CustNmbr",
				'Customer Number' of window RM_Sales_Entry of form RM_Sales_Entry;
			call with name "MBS_Param_Set" in dictionary 5261,
				"RMDocTypeAll",
				str('Document Type' of window 'RM_Sales_Entry' of form 'RM_Sales_Entry');
		end if;
	end if;
end if;
MBS_Parameter = "Value";
call with name "MBS_Param_Set" in dictionary 5261, "Variable", MBS_Parameter;

Trigger #2 – Resource Tab

This is a trigger on the Form Level Procedure for Credit Limit Check – Before Original. This is to capture the existing credit limit information into parameters in SDT and update the credit limit as UNLIMITED for the specific customer (which was retrieved from the parameter value captured earlier). Note the use of “MBS_Param_Get” to retrieve the parameter values. You can use the Helper button to select the coding syntax for retrieving parameter values.

image

Trigger #2 – Customization Script

out 	boolean	OUT_Condition;
local 	string 	MBS_Parameter;
 
local 	string	ls_CustNmbr;
local	string	ls_DocType;
local	integer	li_DocType;
 
OUT_Condition = false;
if true then { Insert Condition Here }
	call with name "MBS_Param_Get" in dictionary 5261, "CustNmbr", ls_CustNmbr;
	call with name "MBS_Param_Get" in dictionary 5261, "RMDocTypeAll", ls_DocType;
	set li_DocType to integer(ls_DocType);
 
	if li_DocType = 2 and not empty(ls_CustNmbr) then
		clear table RM_Customer_MSTR;
		set 'Customer Number' of table RM_Customer_MSTR to ls_CustNmbr;
		change table RM_Customer_MSTR by number 1;
		if err() = OKAY then
			if 'Credit Limit Type' of table RM_Customer_MSTR <> 1 then
				call with name "MBS_Param_Set" in dictionary 5261, "CredLimitType", str('Credit Limit Type' of table RM_Customer_MSTR);
				call with name "MBS_Param_Set" in dictionary 5261, "CredLimitAmt", str('Credit Limit Amount' of table RM_Customer_MSTR);
				call with name "MBS_Param_Set" in dictionary 5261, "CredLimitPeriod", str('Credit Limit Period' of table RM_Customer_MSTR);
				call with name "MBS_Param_Set" in dictionary 5261, "CredLimitPeriodAmt", str('Credit Limit Period Amount' of table RM_Customer_MSTR);
				set 'Credit Limit Type' of table RM_Customer_MSTR to 1;
				set 'Credit Limit Amount' of table RM_Customer_MSTR to 0;
				set 'Credit Limit Period' of table RM_Customer_MSTR to 0;
				set 'Credit Limit Period Amount' of table RM_Customer_MSTR to 0;
				save table RM_Customer_MSTR;
			end if;
		end if;
	end if;
	OUT_Condition = true;
end if;

 

Trigger #3 – Resource Tab

This is a trigger on the Form Level Procedure for Credit Limit Check – After Original. This is to reset the credit limit information back to the original values for the selected customer. Note the use of “MBS_Param_DelAll” procedure to delete any parameters which have been used in the process. You can use the Helper button to select the coding syntax for deleting parameter values.

image

Trigger #3 – Customization Script

OUT 	BOOLEAN		OUT_Condition;
LOCAL 	string 		MBS_Parameter;
 
LOCAL 	string		ls_CustNmbr;
LOCAL	string		ls_DocType;
LOCAL	string		ls_CredLimitType;
LOCAL	string		ls_CredLimitAmt;
LOCAL	string		ls_CredLimitPeriod;
LOCAL	string		ls_CredLimitPeriodAmt;
LOCAL	INTEGER		li_DocType;
LOCAL	INTEGER		li_CredLimitType;
LOCAL	currency	lc_CredLimitAmt;
LOCAL	INTEGER		li_CredLimitPeriod;
LOCAL	currency	lc_CredLimitPeriodAmt;
 
OUT_Condition = FALSE;
IF TRUE THEN { INSERT Condition Here }
	CALL WITH name "MBS_Param_Get" IN dictionary 5261, "CustNmbr", ls_CustNmbr;
	CALL WITH name "MBS_Param_Get" IN dictionary 5261, "RMDocTypeAll", ls_DocType;
	CALL WITH name "MBS_Param_Get" IN dictionary 5261, "CredLimitType", ls_CredLimitType;
	CALL WITH name "MBS_Param_Get" IN dictionary 5261, "CredLimitAmt", ls_CredLimitAmt;
	CALL WITH name "MBS_Param_Get" IN dictionary 5261, "CredLimitPeriod", ls_CredLimitPeriod;
	CALL WITH name "MBS_Param_Get" IN dictionary 5261, "CredLimitPeriodAmt", ls_CredLimitPeriodAmt;
	SET li_DocType TO INTEGER(ls_DocType);
	SET li_CredLimitType TO INTEGER(ls_CredLimitType);
	SET lc_CredLimitAmt TO VALUE(ls_CredLimitAmt);
	SET li_CredLimitPeriod TO INTEGER(ls_CredLimitPeriod);
	SET lc_CredLimitPeriodAmt TO VALUE(ls_CredLimitPeriodAmt);
 
	IF li_DocType = 2 AND NOT empty(ls_CustNmbr) THEN
		clear TABLE RM_Customer_MSTR;
		SET 'Customer Number' OF TABLE RM_Customer_MSTR TO ls_CustNmbr;
		CHANGE TABLE RM_Customer_MSTR BY NUMBER 1;
		IF err() = OKAY THEN
			SET 'Credit Limit Type' OF TABLE RM_Customer_MSTR TO li_CredLimitType;
			SET 'Credit Limit Amount' OF TABLE RM_Customer_MSTR TO lc_CredLimitAmt;
			SET 'Credit Limit Period' OF TABLE RM_Customer_MSTR TO li_CredLimitPeriod;
			SET 'Credit Limit Period Amount' OF TABLE RM_Customer_MSTR TO lc_CredLimitPeriodAmt;
			save TABLE RM_Customer_MSTR;
		END IF;
	END IF;
	CALL WITH name "MBS_Param_DelAll" IN dictionary 5261;
	OUT_Condition = TRUE;
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

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: Customizations, Dynamics, Great Plains, Support Debugging Tool

About the Author ()