#GPPT Form Control Automatically Set Posting Type on Account Maintenance

David Meego - Click for blog homepageGP Power Tools Form Control is a “No Code/Low Code” customization tool for Microsoft Dynamics GP. It can be used to solve many requirements without any coding (or with a small conditional script).

Here is a real-life example showing how you can quickly use Form Control to automatically set the Posting Type to the correct value when the Account Number is entered on the Account Maintenance window.

In Microsoft Dynamics GP, when creating a new record for the Chart of Accounts, it is important to get the Posting Type field set correctly to ensure that the account is included in the desired Balance Sheet or the Profit and Loss report. It is very easy to miss changing this field during the initial creation of the account.

A common business requirement is to default the Posting Type field automatically when the account number is entered.

A standard often used is that Account numbers with a main account segment starting with 1 are Asset accounts, 2 are Liability accounts and 3 are Equity accounts which should all show on the Balance Sheet. Anything else should show on the Profit and Loss report.

This requirement can be created with the Form Control module in a few minutes.

Defaulting Posting Type

The FORM CONTROL GL ACCT Form Control ID is limited by the Base Settings Resource Filter to exactly the GL_Account_Maintenance form in the core dictionary (0).

The Set Field Value rule is limited to exactly the Posting Type field.

The Key Field List is used to specify that the rule should be triggered when the Account Number CS field changes. The desired value for the field can be specified in the Expression field.

A Script ID has been added with a script which will set the value of the Expression field based on the Account Number entered, using the value of the first character of the second segment.

Code Excerpt from FORM CONTROL GL ACCT Form Control Conditional Script

[code]
if MBS_FormControl_Modified then
call with name "MBS_Get_Window_Value_Modified" in dictionary 5261,
MBS_FormControl_Dictionary {Dict},
MBS_FormControl_Form {Form},
MBS_FormControl_Window {Window},
"Account Number CS" {Field},
l_Account_Number, MBS_Status;
else
call with name "MBS_Get_Window_Value" in dictionary 5261,
MBS_FormControl_Dictionary {Dict},
MBS_FormControl_Form {Form},
MBS_FormControl_Window {Window},
"Account Number CS" {Field},
l_Account_Number, MBS_Status;
end if;
if MBS_Status <> OKAY then
debug str(MBS_Status);
end if;

if integer(value(substring(component 2 of field l_Account_Number, 1, 1))) > 3 then
call with name "MBS_Control_Update_Expression" in dictionary 5261, "1";
//warning "1: " + MBS_FormControl_Field;
else
call with name "MBS_Control_Update_Expression" in dictionary 5261, "0";
//warning "0: " + MBS_FormControl_Field;
end if;

[/code]

The MBS_Control_Update_Expression Helper Function is used to change the expression before it is applied.

Note: The Developer Tools module must also be registered to be able to run Form Control Conditional Scripts.

Downloading and Installing

Download the example settings, import using the Project Setup window (without any project showing, select the path to the xml file and click Import):

The Form Controls will be active immediately when the affected windows are next opened.

More Information

For an introduction series for Form Control with step-by-step instructions see:

For more information see:

Hope you find this example useful.

David

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

Leave a Reply