Dexterity Trigger – Microsoft Great Plains customization example


Dexterity Trigger – Microsoft Great Plains customization example

 by: Andrew Karasev

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 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 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 IVItemInquiry window.

Now lets look at the trigger body:

ASTUpdateQtys – this is the name of the trigger

{ Trigger for after Display Existing Record of IVItemInquiry. }

{ Part 1 }

{ Used to calculate and display the qty quoted and subtract the }

{ qty on orders from the qty available. }

local currency lcqtyquoted.

clear field '(L) Quantity Quoted' of window IVItemInquiry of form IVItemInquiry.

set precision of '(L) Quantity Quoted' of window IVItemInquiry

of form IVItemInquiry to 'Decimal Places QTYS' of file IVItemMSTR - 1.

{ If based on site and site blank, set quoted to 0. }

if '(L) Display Options' of window IVItemInquiry of form IVItemInquiry 1 and

'Location Code' of window IVItemInquiry of form IVItemInquiry ""

then

set '(L) Quantity Quoted' of window IVItemInquiry of form IVItemInquiry to 0.

abort script.

end if.

lcqtyquoted rwqtyquotedsite('Item Number' of window IVItemInquiry

of form IVItemInquiry, 'Location Code' of window IVItemInquiry

of form IVItemInquiry).

set '(L) Quantity Quoted' of window IVItemInquiry of form IVItemInquiry

to lcqtyquoted.

set '(L) Quantity Available' of window IVItemInquiry of form IVItemInquiry

to '(L) Quantity Available' of window IVItemInquiry

of form IVItemInquiry - lcqtyquoted.

{ Part 2 }

{ Used to populate the list price. }

set 'List Price' of window IVItemInquiry of form IVItemInquiry to 'List Price'

of table IVItemMSTR.

And this is how you do register the trigger:

Startup – script

local integer lresult.

lresult TriggerRegisterFocus(anonymous('Display Existing Record'

of window IVItemInquiry of form IVItemInquiry), TRIGGERFOCUSCHANGE,

TRIGGERAFTERORIGINAL, script SBUpdateQtys).

if lresult SYNOERR then

warning "Focus trigger registration failed.".

end if.

Let us know if you need help: 1-630-961-5918, 1-866-528-0577 or help@albaspectrum.com