Dex - Working with the Action Button on the SOP_Entry form

David MeegoTime to get into some Dexterity code. I saw a posting today on the Microsoft Dynamics GP community forum.  It was asking about the disappearance of the Void Button from the SOP_Entry form and how to work with the new Action Button.

In v9.0 and earlier versions of Microsoft Dynamics GP, each action had its own button. Other than Save, we had Delete, Void, Post, Transfer, Purchase, Confirm and Copy.  These buttons would be enabled and disabled as appropriate depending on the document type and various business rules.

In v10.0 we wanted to add more actions for new features but there was no more room on the window for additional buttons. The solution was to move all the actions to an Actions Button which could be populated with the valid actions for the current document. So all the actions other than Save and the new workflow Submit for Approval button were moved to the Action Button.

If you wanted to trigger before the Void action, in v9.0 it was a simple focus trigger before the Void Button. So how do you handle this for v10.0.  Below are the code examples to show the easiest way to handle this change.

v9.0 code for Startup procedure and Void Button trigger handling script:

Global Procedure: Startup

{ Startup Procedure }
local integer l_result;

l_result = Trigger_RegisterFocus(anonymous('Void Button NONE' of window SOP_Entry of form SOP_Entry), TRIGGER_FOCUS_CHANGE, TRIGGER_BEFORE_ORIGINAL, script MBS_SOP_Entry_Void_PRE);
if l_result <> SY_NOERR then
    warning "SOP Entry Void PRE Trigger registration failed.";
end if;

 

Global Procedure: MBS_SOP_Entry_Void_PRE

{ MBS_SOP_Entry_Void_PRE procedure }
warning "Void is disabled";
reject script;
abort script;

 

v10.0 code for Startup procedure and Action Button trigger handling script:

Global Procedure: Startup

{ Startup procedure }
local integer l_result;

l_result = Trigger_RegisterFocus(anonymous('Action Button' of window SOP_Entry of form SOP_Entry), TRIGGER_FOCUS_CHANGE, TRIGGER_BEFORE_ORIGINAL, script MBS_SOP_Entry_Action_PRE);
if l_result <> SY_NOERR then
    warning "SOP Entry Action PRE Trigger registration failed.";
end if;

 

Global Procedure: MBS_SOP_Entry_Action_PRE

{ MBS_SOP_Entry_Action_PRE Procedure }
case itemdata('Action Button' of window SOP_Entry of form SOP_Entry, 'Action Button' of window SOP_Entry of form SOP_Entry)
    in [ACTION_POST of form SOP_Entry]
    in [ACTION_TRANSFER of form SOP_Entry]
    in [ACTION_PURCHASE of form SOP_Entry]
    in [ACTION_CONFIRMPICK of form SOP_Entry]
    in [ACTION_CONFIRMPACK of form SOP_Entry]
    in [ACTION_CONFIRMSHIP of form SOP_Entry]
    in [ACTION_COPY of form SOP_Entry]
    in [ACTION_DELETE of form SOP_Entry]
    in [ACTION_VOID of form SOP_Entry]
        warning "Void is disabled";
        reject script;
        abort script;
    else
end case;

 

Please forgive the literal (hard coded) string, but this is just to show the concept and I know that you will all use a getmsg() when you use this in your real code. For more information on handling literal strings look at the Best Practices section of the Dexterity Articles & Links page.

If you want to work with the Action Button from Visual Basic for Applications (VBA), have a look at the following post from Mariano Gomez on the topic:

Upgrading SOP Entry VBA Customizations from Dynamics GP 9.0 to Dynamics GP 10.0

Hope this is helpful.

David

Ref: Content Idea 100401