Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extra's Menu

Status
Not open for further replies.

DCCalif

Programmer
Apr 26, 2010
8
US
I'm currently migrating our older version of Great Plains to the newest version of 10.0. Way back when we added a Extra's menu on the startup script in the following way:

set l_result to Trigger_RegisterForm(form
Cards_Financial_Palette,
"PA Extras Application", "", script
PA_Main_Menu);
if l_result<>SY_NOERR then
warning "Form trigger registration failed.";
if l_result=LOCKED then
warning "This recrod has been locked";
else
warning "This error came from the Startup
Script";
end if;
end if;

This would allow the user to go to "Cards" then Financial and see an "Extra's" menu that all the custom forms would hang off of. Worked great for years.

For the life of me I can't see how this is done in the newest version of 10.0. The menu structure is very different but all I want to do is hang a few menus in there own area. Any suggestions on how to achive this wouild be greatly appreciated.
 
I'm not exactly sure on how to do submenus which is what it looks like you want, but I might be able to point you in the right direction.

The function to add a command to a menu is AddCommandToMenu.
Code:
    Seq = 0;
    Status = AddCommandToMenu(DYNAMICS,
        resourceid(form Command_Sales),
        resourceid(command CL_Sales_Transactions of form Command_Sales),
        Seq,
        Prod_ID,
        resourceid(form Command_OurForm),
        resourceid(command OurForm_Open of form Command_OurForm),
        true,
        LoadMode);

    if Status <> OKAY then
        error "Could not add command OurForm_Open.";
    end if;

This bit of code adds a menu item (command OurForm_Open) which was defined in our form Command_OurForm to the Transactions > Sales menu.

Hope that helps you out.
 
Thank for so far but a few more questions.

First, what is the Command used for in the Form?

Also, I added the following into my startup script:

Seq = 0;
Status = AddCommandToMenu(DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Cards of form
Command_Sales),
Seq,
2222, { this is the ID of my Custom Dictionary}
resourceid(form PA_Main_Menu), {Custom Form}
resourceid(command PA_Main_Cmd of form PA_Main_Menu),
true,LoadMode);

if Status <> OKAY then
error "Could not add PA_Main_Menu command
CL_Sales_Cards.";
end if;


When I open up GP, I'm getting the error "Could not add PA_Main_Menu command CL_Sales_Cards."

The Status = 1 which does not tell what is going wrong.

Thanks in advance.
 
I guess I missed part, I'll start from the beginning this time.

First the command should exist on the form in question. In my case it would open a form, and this was the definition I used:

Code:
Command Name: OurForm_Open
Display Name: Menu Item Text
Tooltip: 
Shortcut: <None>
Security Form: OurForm_Items

Type
-----------
+ Form: OurForm_Items

Next that AddCommandToMenu command should be in a Global procedure with the following parameters and checks.

Code:
in integer LoadMode;
optional in boolean ShowProgress;

local CmdSequence Seq;
local integer Status;
local boolean AddMenuItems;
local integer Prod_ID;
Prod_ID = Runtime_GetCurrentProductID();

{Set the flag indicating that menu items should be added}
AddMenuItems = true;

if LoadMode = MENULOAD_TOTABLE then
    {Find out whether the menu items exist in the Menu Master table.}
    if MenusExistForProduct(Prod_ID) of form syMenuObj = true then
        {Do not need to add the menu items}
        AddMenuItems = false;
    end if;
end if;

if AddMenuItems = true then
  {Menu creation goes here}
end if;

We need that check to make sure that menus that get created to a table in the database don't get created a second time.

Then in the startup script you need to add a trigger to get this to run:
Code:
if Trigger_RegisterProcedure(script CreateDefaultMenuStructure, TRIGGER_AFTER_ORIGINAL, script OurScript_CreateMenuItems) <> SY_NOERR then
    warning "Procedure trigger registration failed.";
end if;

For more detailed information (and information about submenus) look in the Integration Guide in Chapter 22 (about page 173) for detailed procedure and examples.
 
The Trigger_RegisterForm() method still works, you will find the Extras menu under the Additional menu from v10.0 onwards.

David

David Musgrave [MSFT]
Escalation Engineer - Microsoft Dynamics GP
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

mailto:David dot Musgrave at microsoft dot com

Any views contained within are my personal views and not necessarily Microsoft policy.
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top