public void Initialize() { // Menu to open Lookups form Dynamics.Forms.AboutBox.AddMenuHandler(OpenLookupWindow, "Lookups", ""); // Select button on the Customers lookup window Microsoft.Dexterity.Applications.SmartListDictionary.CustomerLookupForm customerLookupForm = SmartList.Forms.CustomerLookup; customerLookupForm.CustomerLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(CustomerSelectButton_ClickBeforeOriginal); // Select button on the Vendors lookup window Microsoft.Dexterity.Applications.SmartListDictionary.VendorLookupForm vendorLookupForm = SmartList.Forms.VendorLookup; vendorLookupForm.VendorLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(VendorSelectButton_ClickBeforeOriginal); // Select button on the Items lookup window Microsoft.Dexterity.Applications.SmartListDictionary.IvItemNumberLookupForm itemNumberLookupForm = SmartList.Forms.IvItemNumberLookup; itemNumberLookupForm.IvItemNumberLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(ItemSelectButton_ClickBeforeOriginal); // Select button on the GL Account lookup window Microsoft.Dexterity.Applications.SmartListDictionary.AccountLookupForm accountLookupForm = SmartList.Forms.AccountLookup; accountLookupForm.AccountLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(AccountSelectButton_ClickBeforeOriginal); // Select button on the SOP Document lookup window Microsoft.Dexterity.Applications.SmartListDictionary.SopDocumentLookupForm sopLookupForm = SmartList.Forms.SopDocumentLookup; sopLookupForm.SopDocumentLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(SOPDocumentSelectButton_ClickBeforeOriginal); // Select button on the POP Document lookup window Microsoft.Dexterity.Applications.SmartListDictionary.PopDocumentLookupForm popLookupForm = SmartList.Forms.PopDocumentLookup; popLookupForm.PopDocumentLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(POPDocumentSelectButton_ClickBeforeOriginal); // Validate script that prevents the POP Document lookup window from being displayed popLookupForm.PopDocumentLookup.PopPoLookup.ValidateBeforeOriginal += new System.ComponentModel.CancelEventHandler(PopPoLookup_ValidateBeforeOriginal); }
private void VendorLookup_Click(object sender, EventArgs e) { // Create a reference to the VendorLookup form Microsoft.Dexterity.Applications.SmartListDictionary.VendorLookupForm vendorLookup = SmartList.Forms.VendorLookup; // Set the flag indicating that we opened the lookup GPAddIn.ReturnToLookup = true; // Open the VendorLookup form vendorLookup.Open(); // Set the field values on the lookup window vendorLookup.VendorLookup.VendorId.Value = VendorID.Text; vendorLookup.VendorLookup.VendorName.Value = ""; //Vendor Name vendorLookup.VendorLookup.VendorClassId.Value = ""; //Vendor Class vendorLookup.VendorLookup.UserDefined1.Value = ""; //User Defined 1 vendorLookup.VendorLookup.VendorSortBy.Value = 1; //Sort by // Run Validate on the Vendor Sort By to fill the lookup window vendorLookup.VendorLookup.VendorSortBy.RunValidate(); }
void VendorSelectButton_ClickBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e) { // Run this code only if the Visual Studio Tools add-in opened the lookup. if (GPAddIn.ReturnToLookup == true) { // Retrieve the vendor ID of the row selected in the scrolling window // of the Vendors lookup. Microsoft.Dexterity.Applications.SmartListDictionary.VendorLookupForm vendorLookupForm = SmartList.Forms.VendorLookup; string vendorID = vendorLookupForm.VendorLookup.VendorLookupScroll.VendorId; // Display the value retrieved LookupsWindow.VendorID.Text = vendorID; // Clear the flag that indicates a value is to be retrieved from the lookup. GPAddIn.ReturnToLookup = false; } }