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!

Dexterity Integration Issues 1

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
US
It doesn't appear as if there is a forum here for Dexterity programming - so this is going here. (sorry for the winded post, but I thought I'd better explain in full where I'm at)

I went through the entire Quick Start guide to get a feel for how to create an application in Dexterity.

So I began work on my integration. I've copied my Dynamics.dic file to a development folder to use for development.

The first thing I did was create a simple Form/Window to house my integration, and then try to create a menu item so that I can actually access and test it.

The IG manual wasn't very clear on how to add a menu item (ie. places to put the scripts), but by examining the sample integration I was able to figure out how it was supposed to be handled.

I first created a Form (Command_PDP_IG) which contains a Window (Dummy) that has AutoOpen equal to False. It also contains the command mnuPDP_IG_Open which has a type script:
Code:
open form PDP_IG;
I then created a script to add the menu item to the form. I basically modified the example script slightly to supposed to add my menu item (along with a separator). According to my understanding these should show up in Cards>>Sales.
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(PDP_IG_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
    {Add a separator, which is a built-in command}
    Seq = 0;
    Status = AddCommandToMenu(DYNAMICS,
        resourceid(form Command_Sales),
        resourceid(command CL_Sales_Cards of form Command_Sales),
        Seq,
        CMD_BUILTINCMD_DICTID,
        CMD_BUILTINCMD_FORMID,
        resourceid(command cmdSeparator),
        true,
        LoadMode);

    if Status <> OKAY then
        error "Could not add separator item.";
    end if;

    {Add the mnuPDP_IG_Open command}
    Seq = 0;
    Status = AddCommandToMenu(DYNAMICS, 
        resourceid(form Command_Sales), 
        resourceid(command CL_Sales_Cards of form Command_Sales),
        Seq,
        PDP_IG_PROD_ID,
        resourceid(form Command_PDP_IG),
        resourceid(command mnuPDP_IG_Open of form Command_PDP_IG),
        true,
        LoadMode);

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

I then added a script called Startup that added this as a trigger:
Code:
local integer l_result;
{local string path;
local boolean result;}

pragma(disable warning LiteralStringUsed);

l_result = Trigger_RegisterProcedure(script CreateDefaultMenuStructure, TRIGGER_AFTER_ORIGINAL, script PDP_IG_CreateMenuItems);
if l_result <> SY_NOERR then
    warning "Procedure trigger registration failed.";
end if;

pragma(enable warning LiteralStringUsed);

I have confirmed that the script PDP_IG_CreateMenuItems does indeed run (by placing warning prompts at the beginning of the script), yet I receive no errors - but I see no menu item either.

The command does have display text, and I've tried using the product Id return from the Runtime_GetCurrentProductID() function (found that from Dave on another site).

Ideally I'd like the menu item under Transactions>>Sales - but that is trivial (CL_Sales_Transactions).

How can I get this menu item to show up? Any ideas?
 
Hi Borvik

Here are my thoughts.

1) On your command form, add the command as type form and select the form. This is preferred to using a script to open a form as it allows Advanced Security to work with your menus in the By Menu view. If on v9.0 also make sure you select the Security form.... this was added to help with the Advanced Security issue when scripts are used.

2) Do not use PDP_IG_PROD_ID for you dictionary ID as this will only work in runtime mode. Use Runtime_GetCurrentProductID() function instead. I saw you found this already. You can use the variable you have defined as Prod_ID.

3) Use DYNAMICS for any core resources.

4) Your code seems to be missing the code to make sure that your command form is opened and closed as needed. You need to add the triggers:

if Trigger_RegisterProcedure(script 'OpenCommandForms', TRIGGER_AFTER_ORIGINAL, script PDP_OpenCommandForms_POST) <> SY_NOERR then
warning "OpenCommandForms procedure trigger registration failed.";
end if;
if Trigger_RegisterProcedure(script 'CloseCommandForms', TRIGGER_AFTER_ORIGINAL, script PDP_CloseCommandForms_POST) <> SY_NOERR then
warning "CloseCommandForms procedure trigger registration failed.";
end if;


{PDP_OpenCommandForms_POST}
open form Command_PDP_IG;

{PDP_CloseCommandForms_POST}
closeform Command_PDP_IG;

Hope this helps.

PS: If you can get to Singapore (August) or Melbourne (September) I am running Dexterity training.

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer - Great Plains
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Thanks Dave.

I would love to be able to make it to one of your Dexterity training session - unfortunately I won't be able to.

I bet that's why it didn't work (Opening the command forms). If they aren't open how can the menu be there.

I was using v9 - though I am now using v10 and am starting over today.

Thanks for the pointers.
 
One quick question about one of the suggestions:
If on v9.0 also make sure you select the Security form.... this was added to help with the Advanced Security issue when scripts are used.
What should this be set to - the same as form (when set as a form type)?
 
Hi

Yes, the Security form should be set to the same as the form you open. This was added to allow scripts to be used, but still allow Advanced Security to identify the form it should link to for the By Menu view.

Glad I could help.

David Musgrave [MSFT]
Senior Development Consultant
Escalation Engineer - Great Plains
Microsoft Dynamics Support - Asia Pacific

Microsoft Dynamics (formerly Microsoft Business Solutions)

Any views contained within are my personal views and
not necessarily Microsoft Business Solutions policy.
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
Awesome - you are a great help Dave!

I'm sure I'll have more questions soon as I'm working through my customizations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top