Thursday, September 19, 2024

Dexterity Trigger Microsoft Great Plains Customization Example

Microsoft Great Plains has multiple customization options. You can use SQL programming from the back end, or VBA/Modifier to slightly improve end-user interface.

The most flexible mechanism is Great Plains Dexterity customization. Dexterity is the programming language and environment, the whole Great Plains is written on. Dexterity, however requires some training or self preparation, before you do the coding itself. In this small article we would like to give you a Dexterity trigger example. You can install Dexterity from Microsoft Great Plains CD#2.

The trigger calculates QTY quoted for the inventory item and places the result into “Quantity Quoted” custom field, plus it updates QTY available – subtracts QTY on orders, the trigger fires when we open IV_Item_Inquiry window.

Now lets look at the trigger body:

AST_Update_Qtys - this is the name of the trigger

{* Trigger for after Display Existing Record of IV_Item_Inquiry. *}

{* Part 1 *}
{* Used to calculate and display the qty quoted and subtract the *}
{* qty on orders from the qty available. *}
local currency lc_qty_quoted.

clear field '(L) Quantity Quoted' of window IV_Item_Inquiry of form IV_Item_Inquiry.
set precision of '(L) Quantity Quoted' of window IV_Item_Inquiry
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp of form IV_Item_Inquiry to 'Decimal Places QTYS' of file IV_Item_MSTR - 1.

{* If based on site and site blank, set quoted to 0. *}
if '(L) Display Options' of window IV_Item_Inquiry of form IV_Item_Inquiry = 1 and
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 'Location Code' of window IV_Item_Inquiry of form IV_Item_Inquiry = ""
then
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp set '(L) Quantity Quoted' of window IV_Item_Inquiry of form IV_Item_Inquiry to 0.
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp abort script.
end if.

lc_qty_quoted = rw_qty_quoted_site('Item Number' of window IV_Item_Inquiry
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp of form IV_Item_Inquiry, 'Location Code' of window IV_Item_Inquiry
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp of form IV_Item_Inquiry).
set '(L) Quantity Quoted' of window IV_Item_Inquiry of form IV_Item_Inquiry
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp to lc_qty_quoted.
set '(L) Quantity Available' of window IV_Item_Inquiry of form IV_Item_Inquiry
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp to '(L) Quantity Available' of window IV_Item_Inquiry
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp of form IV_Item_Inquiry - lc_qty_quoted.

{* Part 2 *}
{* Used to populate the list price. *}
set 'List Price' of window IV_Item_Inquiry of form IV_Item_Inquiry to 'List Price'
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp of table IV_Item_MSTR.

And this is how you do register the trigger:

Startup - script

local integer l_result.

l_result = Trigger_RegisterFocus(anonymous('Display Existing Record'
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp of window IV_Item_Inquiry of form IV_Item_Inquiry), TRIGGER_FOCUS_CHANGE,
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp TRIGGER_AFTER_ORIGINAL, script SB_Update_Qtys).
if l_result SY_NOERR then
&nbsp&nbsp&nbsp&nbsp warning "Focus trigger registration failed.".
end if.

Andrew Karasev is Chief Technology Officer in Alba Spectrum Technologies USA nationwide Microsoft CRM, Microsoft Great Plains customization company, based in Chicago, California, Texas, New York, Georgia and Florida and having locations in multiple states and internationally (www.albaspectrum.com), he is Dexterity, SQL, C#.Net, Crystal Reports and Microsoft CRM SDK developer.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

Benefits of running a property management company.