SmartList Builder Execute Procedure Go To Changes for GP 2010

David Meego - Click for blog homepageIf you are a Dexterity developer who uses SmartList Builder to create SmartList favorites for your products and you use the Execute Procedure Go To functionality.  This post is for you.

Below is a screenshot of the v10.0 window used for adding a Go To which executes a global procedure.  You will notice that the Procedure field is a string field into which the procedure name can be typed.

In SmartList Builder for Microsoft Dynamics GP 2010, this window has changed to use a drop down list for the Procedure field. 

I would suggest that this change was made as a security measure to only allow specific procedures to be called.  But how to you get the drop down list populated with your procedures....


The information below is based on documentation provided by the SmartList Builder development team. 

SmartList Builder and Navigation Builder both have goto/action types called Execute Procedure. This type can be used by third party developers to add their own gotos and actions into SmartList Builder and Navigation List Builder.

There are 3 global procedures that have been provided to allow easy integration:

  • FillRunProcedureList
  • GetRunProcedureParameterCount
  • GetRunProcedureParameterName

On each of the Execute Procedure setup windows, there is a drop down list of all procedures available to be executed from each product. This list is filled using FillRunProcedureList. When a procedure is selected, the list of parameters for the procedure is displayed. The list is determined by the GetRunProcedureParameterCount and GetRunProcedureParameterName procedures.

To integrate your Dexterity product with this functionality you will need to register triggers against these procedures.

NOTE: The scripts below use a constant called MY_PRODUCT which should contain the Product ID of your Dexterity product, if you already have this stored as a constant, modify the code accordingly. You will also need to create a SLB_PRODUCT constant with a value of 3830.


Startup Trigger Registration Example

 { Add to Global Procedure: Startup }<br>{Turn off the warning for literal strings}<br>pragma(disable warning LiteralStringUsed);<br>if not empty(Launch_GetFileName()) then<br>    { In Runtime Mode }<br>    if Launch_GetProdPosition(SLB_PRODUCT) > 1 then<br>        { SLB Installed }                if Trigger_RegisterProcedureByName(SLB_PRODUCT, "FillRunProcedureList", TRIGGER_AFTER_ORIGINAL, script FillRunProcedureList_POST) <> SY_NOERR then<br>            error "Error registering Trigger against Smartlist Builder FillRunProcedureList Procedure.";<br>        end if;                if Trigger_RegisterProcedureByName(SLB_PRODUCT, "GetRunProcedureParameterCount", TRIGGER_AFTER_ORIGINAL, script GetRunProcedureParameterCount_POST) <> SY_NOERR then<br>            error "Error registering Trigger against Smartlist Builder GetRunProcedureParameterCount Procedure.";<br>        end if;                if Trigger_RegisterProcedureByName(SLB_PRODUCT, "GetRunProcedureParameterName", TRIGGER_AFTER_ORIGINAL, script GetRunProcedureParameterName_POST) <> SY_NOERR then<br>            error "Error registering Trigger against Smartlist Builder GetRunProcedureParameterName Procedure.";<br>        end if;            end if;<br>end if;<br>{Turn the literal string warning back on}<br>pragma(enable warning LiteralStringUsed);


FillRunProcedureList Trigger Handler Example

 { Global Procedure: FillRunProcedureList_POST }

in integer ii_product_id;
inout anonymous field iof_list;

{Turn off the warning for literal strings}
pragma(disable warning LiteralStringUsed);

case ii_product_id
    in [MY_PRODUCT]
        add item "MyProcedure" to iof_list;
    else
end case;

{Turn the literal string warning back on}
pragma(enable warning LiteralStringUsed);

GetRunProcedureParameterCount Trigger Handler Example

 { Global Procedure: GetRunProcedureParameterCount_POST }

in integer ii_product_id;
in string is_procedure_name;
out integer oi_parameter_count;

{Turn off the warning for literal strings}
pragma(disable warning LiteralStringUsed);

case ii_product_id
    in [MY_PRODUCT]
        case is_procedure_name
            in ["MyProcedure"]
                oi_parameter_count = 2;
            else
        end case;
    else
end case;

{Turn the literal string warning back on}
pragma(enable warning LiteralStringUsed);

GetRunProcedureParameterName Trigger Handler Example

 { Global Procedure: GetRunProcedureParameterName_POST }

in integer ii_product_id;
in string is_procedure_name;
in integer ii_parameter_number;
out string os_parameter_name;

{Turn off the warning for literal strings}
pragma(disable warning LiteralStringUsed);

case ii_product_id
    in [MY_PRODUCT]
        case is_procedure_name
            in ["MyProcedure"]
                case ii_parameter_number
                    in [1]
                        os_parameter_name = "MyParameter1";
                    in [2]
                        os_parameter_name = "MyParameter2";
                    else
                end case;
            else
        end case;
    else
end case;

{Turn the literal string warning back on}
pragma(enable warning LiteralStringUsed);

I hope you find this post useful when upgrading your code to work with GP 2010. 

David

// Copyright © Microsoft Corporation. All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, https://opensource.org/licenses/ms-pl.html.)