Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

PopVendorItemsForm lookup in visual studio

Posted on by Microsoft Employee

Hello,

I am trying to get the vendor items lookup form to open up in GP from a custom form built in Visual Studio with the Dynamics GP Addin Project.

I am currently running into a problem where once it hits the open line of the form, it just closes right away and doesn't do anything else to it from the code. I have tried many things but can't quite figure it out. I am wondering if anyone has gotten this to work within visual studio.

My code is below for the lookup. It might not all be right.

Thanks,

//show the vendor item lookup form

PopVendorItemsForm popVendorItemsForm = SmartList.Forms.PopVendorItems;
// PopVendorItemsForm.PopVendorItemsWindow popVendorItemsWindow = popVendorItemsForm.PopVendorItems.IvItemVendorLookup..PopVendorItems;

popVendorItemsForm.Open();

popVendorItemsForm.PopVendorItems.LocalVendorSortBy.Value = 1;
popVendorItemsForm.PopVendorItems.IvItemVendorLookup.SortBy.Value = 1;
popVendorItemsForm.PopVendorItems.IvItemVendorLookup.RunValidate();
popVendorItemsForm.PopVendorItems.LocalVendorSortBy.RunValidate();
//Set the ReturnToLookup flag to true so we know we called the lookup window.
GPAddIn.ReturnToVendorItemLookup = true;

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: PopVendorItemsForm lookup in visual studio

    vendoritems.png

    You can see on the bottom bar, its slightly open, that is after its closed after being opened for a split second.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: PopVendorItemsForm lookup in visual studio

    Mariano,

    Thanks for the quick response. However, it did not solve the problem. So what happens when I debug the code, it will hit the popVendorItems.Open() line and as soon as it does it, it opens the form in GP and then right away closes it again. Its like there is another event that is fired off that is closing the form as soon as it opens. SO when I click my lookup button on my form without debugging, the vendor items form flashes on my screen for about 100 ms.

    Have you ever run into that before on other lookups?

    Thanks,

    Seth

  • Suggested answer
    Mariano Gomez Profile Picture
    Mariano Gomez 26,225 on at
    RE: PopVendorItemsForm lookup in visual studio

    Try this:

               PopVendorItemsForm popVendorItems = Dynamics.Forms.PopVendorItems;
    
                if (popVendorItems.IsOpen == false) 
                {
                    popVendorItems.Open();
                }
    
                popVendorItems.PopVendorItems.IvItemVendorLookup.SortBy.Value = 1;
                popVendorItems.PopVendorItems.LocalVendorSortBy.Value = 1;
                popVendorItems.PopVendorItems.IvItemVendorLookup.VendorId.Value = "";
                popVendorItems.PopVendorItems.IvItemVendorLookup.VendorItemNumber.Value = "";
                popVendorItems.PopVendorItems.IvItemVendorLookup.ItemNumber.Value = "";
                popVendorItems.PopVendorItems.IvItemVendorLookup.VendorItemDescription.Value = "";
                popVendorItems.PopVendorItems.IvItemVendorLookup.Return.Value = 1;
    
    
                popVendorItems.PopVendorItems.LocalVendorSortBy.RunValidate();
    


    There are techniques to capture the value being returned from a Dex lookup window to a Visual Studio Tools WinForm field, but let's make sure the above works first.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans