Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

User Defined Programming in VS Tools

(0) ShareShare
ReportReport
Posted on by

Hi all,

I am new to Dynamics GP Customization. Recently we setup POP User Defined in our GP Installation. They are great to record other relevant information before user posted the transaction (in this case is the Receipt Transaction Entry). But sometimes users make mistake in keying the User Defined Field and need to change that info. The Receipt itself is correct, so I do not see any need to void/return the transaction. User can not change the User Defined Field from Inquiry Window.

When this request to edit the User Defined raised by users, I simply edit the table directly via SQL. This works well, but I am trying to solved this via VS Tools Customization (completely new to me)

Has anyone done this kind of customization?

The POP Inquiry Receiving Form and POP Receiving Entry Form has been customized by our partner. I have learn to use DAG.EXE and has managed to create the assembly

I have coded some line to open the POP User Defined Entry Window, but it is not the same than when we open it while making Entry in POP Receiving Trx Window. It show the window, but all label (link prompt in dex lingo) is empty, and I can not make sense how to key in the primary key for all the User Defined Field, which is POPRCTNM field in the table

Below is my code so far. 

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Dexterity.Bridge;
using Microsoft.Dexterity.Applications;
using Microsoft.Dexterity.Applications.DynamicsDictionary;

namespace EditPOPUserDefinedAfterPost
{
public class GPAddIn : IDexterityAddIn
{
//// Keep a reference to the Estimate Freight WinForm.
//static EstimateFreight EstimateFreightForm;

// Create a reference to the Receiving Entry Alternate Form
static PopReceivingsEntryForm POPReceivingsEntryForm = PurchaseRequisition.Forms.PopReceivingsEntry;
// Create a reference to the POP Receiving User Defined Entry Form
static PopReceivingsUserDefinedEntryForm POPReceivingsUserDefinedEntryForm = Dynamics.Forms.PopReceivingsUserDefinedEntry;

// Create a reference to the Receiving Inquiry Alternate Form
static PopInquiryReceivingsEntryForm POPInquiryReceivingsEntryForm = PurchaseRequisition.Forms.PopInquiryReceivingsEntry;

//// Create a reference to the Receiving Entry Alternate window
static PopReceivingsEntryForm.PopReceivingsEntryWindow POPReceivingsEntryWindow = POPReceivingsEntryForm.PopReceivingsEntry;

//Create a reference to the Receivings Entry User Defined Window
static PopReceivingsUserDefinedEntryForm.PopRcvUserDefEntryWindow POPReceivingsUserDefinedEntryWindow = POPReceivingsUserDefinedEntryForm.PopRcvUserDefEntry;

// Create a reference to the Receiving Inquiry Alternate window
static PopInquiryReceivingsEntryForm.PopInquiryReceivingsEntryWindow POPInquiryReceivingsEntryWindow = POPInquiryReceivingsEntryForm.PopInquiryReceivingsEntry;

// IDexterityAddIn interface

public void Initialize()
{
//// Add the menu item to open the UserDefined Window
POPInquiryReceivingsEntryForm.AddMenuHandler(OpenUserDefined, "User Defined", "N");
}

// Method to open the User Defined Window
static void OpenUserDefined(object sender, EventArgs e)
{
POPReceivingsUserDefinedEntryWindow.Open();
}

}
}

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    on at
    RE: User Defined Programming in VS Tools

    The solution to this problem implemented with VS Community 2013 can be found

    https://github.com/HendryLeo/DynamicsGP/tree/master/EditPOPUserDefinedAfterPost

  • Community Member Profile Picture
    on at
    RE: User Defined Programming in VS Tools

    This route is also fruitless, maybe because of me lacking any dexterity training.

    At some point I used this sanscript

    local POP_Setup POPSetup

    call OpenWindow of form POP_Receivings_UserDefined_Entry, POPSetup, ""GRN1400878"";

     

    The window did open, but with errors. So I chose to abandon this route and focus on recreating this functionality in WinForm

  • Community Member Profile Picture
    on at
    RE: User Defined Programming in VS Tools

    Seems like I have to use Continuum for this call, below is the code. So far still can not figure out the correct sanscript

    static void OpenUserDefined(object sender, EventArgs e)
    {
    try
    {
    Dynamics.Application gpApp = (Dynamics.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Dynamics.Application"));
    if (gpApp == null)
    return;
    else
    {
    string passthrough_code = "";
    string compile_err;
    int error_code;

    passthrough_code += @"call OpenWindow of form POP_Receivings_UserDefined_Entry, 1-," + '"' + '"' + POPInquiryReceivingsEntryWindow.PopReceiptNumber + '"' + '"' + ";";


    gpApp.CurrentProductID = 0;

    error_code = gpApp.ExecuteSanscript(passthrough_code, out compile_err);
    MessageBox.Show(passthrough_code + " = " + compile_err);
    return;
    }
    }
    catch
    {
    MessageBox.Show("Failed to initialize gpApp");
    return;
    }
    }

    This give error ==> Syntax error: ', '. 

    for the following sanscript:

    call OpenWindow of form POP_Receivings_UserDefined_Entry, 1-, ""GRN1400878"";

  • Community Member Profile Picture
    on at
    RE: User Defined Programming in VS Tools

    Further reading to VS Tools Programmer Guide reveal that

    Chapter 7: Accessing Dictionary ResourcesAccessing additional resourcesSeveral additional resource types are accessed through the Forms property of a
    dictionary class. These include:
    • Windows
    • Commands
    • Form-level procedures
    • Form-level functions
    • Form-level table buffers
    As an example, the following C# statement opens the Customer Maintenance
    window. Notice how the window is accessed through the form object.
    Dynamics.Forms.RmCustomerMaintenance.RmCustomerMaintenance.Open();

    Further digging to Dynamics 2013 SDK

    reveal the following Form level Procedures available:

    ------------------------------------------------------------------------
    PURCHASING FORM PROCEDURE: OpenWindow
    of form POP_Receivings_UserDefined_Entry
    ------------------------------------------------------------------------
    inout POP_Setup POP_Setup;
    in 'POP Receipt Number' sRcptID;

    But when trying to do

    Dynamics.Forms.PopReceivingsUserDefinedEntry.Procedures.OpenWindow

    I got the following error in VS Studio

    Error 1 'Microsoft.Dexterity.Applications.DynamicsDictionary.PopReceivingsUserDefinedEntryForm.FormProcedures' does not contain a definition for 'OpenWindow' and no extension method 'OpenWindow' accepting a first argument of type 'Microsoft.Dexterity.Applications.DynamicsDictionary.PopReceivingsUserDefinedEntryForm.FormProcedures' could be found (are you missing a using directive or an assembly reference?) 

    Looks like not all Form Level Procedure is exposed to VS Tools. Is that correct or am I missing anything.

    PS: I am using VS 2013 Community Edition. Since it is not supported by MS GP VS Tools setup, I extracted VS 2012 GP Template from the msi file and follow this article http://dynamicsgpblogster.blogspot.com/2013/12/visual-studio-tools-for-microsoft.html

    In case anyone has VS 2012 that is setup with GP 2013 VS Tools via setup, can you verify that the Form Level Procedures are available to you.

    Edit: This link http://msdn.microsoft.com/en-us/library/cc543646.aspx provides some explanation for this behavior, but there is some terminology that I am not familiar

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Almas Mahfooz Profile Picture

Almas Mahfooz 3 User Group Leader

Featured topics

Product updates

Dynamics 365 release plans