another blog

Icon

About Microsoft Dynamics GP :-)

Registering Procedure Trigger on VS Tools.

Dynamics GP Community Post

Example:

public static Microsoft.Dexterity.Applications.DynamicsDictionary.SopPoPreviewForm.FormProcedures poProc = Dynamics.Forms.SopPoPreview.Procedures;

public void Initialize()
        {  
               poProc.PoGetAddNewSuitable.InvokeAfterOriginal += PoGetAddNewSuitable_InvokeAfterOriginal;

        }

private void PoGetAddNewSuitable_InvokeAfterOriginal(object sender, Microsoft.Dexterity.Applications.DynamicsDictionary.SopPoPreviewForm.PoGetAddNewSuitableProcedure.InvokeEventArgs e)
        {
            //throw new NotImplementedException();
            
            MessageBox.Show(e.inParam1);

        }

PoGetAddNewSuitable procedure is called as many time as there are items on sales order, if you only need to capture sales document number and type then look for other procedure, although you will have these value from this procedure as well but your code will run each time procedure will be called.

Filed under: Dynamics GP, dynamics-gp, VSTools

SOP_DP_Print_Forms

Few days back I had to do some customization involving registering trigger for SOP_DP_Print_Forms procedure, so to save time I google it and ended up to Dynamics GP Community Post having my own answer. 🙂

This time I was trying to directly call this procedure from 3rd party window, but unfortunately I was unsuccessful in doing so, I didn’t get any exception but not able to print the desired report by calling this procedure. May be I am missing anything. I would glad to know if anyone have called this procedure successfully from their dexterity code.

Below is the details from Microsoft Documents for this procedure.

Description:

This script will print Sales Order Processing documents. This script should be called in the background. The different types of documents which can be printed and how to accomplish them are as follows:          

Single Document-Set the IN_Type and IN_Doc parameters to the document to be printed.        

Batch of Documents-Set the IN_Batch parameter to the regular Sales Order Processing batch (batch source = getmsg(SOP_BATCH_SOURCE).         

Range of documents (document number, document date and/or Batch Number)-Set the IN_Start_Doc, IN_End_Doc, IN_Start_Doc_Date, IN_End_Doc_Date, IN_Start_Batch and IN_End_Batch parameters to the desired values at the same time.  If Advanced Distribution is available, then a range can also be set for SOP Status using the IN_Start_SOP_Status and IN_End_SOP_Status.

Historical documents can also be printed in ranges with version 8.0.

The first 8 array cells in the array parameters correspond to the following document type constants which are used to store the destinations for the documents and the alignment forms:

            SOP_QUOTE

            SOP_ORDER

            SOP_INVOICE

            SOP_RETURN

            SOP_BACK_ORDER

            SOP_FULFILLMENT_ORDER

            SOP_PICKING_TICKET

            SOP_PACKING_SLIP

           or

            SOP_EDIT_LIST

          or

            SOP_BATCH_LIST
The 9th cell is used for an exception report. The constant for this is:

            SOP_EXCEPTION_REPORT

Parameters:

in          integer              IN_Print_Group_Box;     {0=document, 1=alignment form, 2=edit list, 3=batch list}

in          integer              IN_Type;                       {the type of the single document}

in          ‘SOP Number’   IN_Doc;                        {the number of the single document}

in          ‘Batch Number’  IN_Batch;                      {the batch number}

in          boolean             fPrintingList;                 {Indicates printing from lists}

in          ‘SOP Number’   IN_Start_Doc,               {the starting document number}

in         ‘SOP NUMBER’ IN_End_Doc;                {the ending document number}

in          date                  IN_Start_Doc_Date,       {the starting document date}

in          date                  IN_End_Doc_Date;        {the ending document date}

in          ‘Batch Number’  IN_Start_Batch,             {the starting Batch Number}

                                    IN_End_Batch;              {the ending Batch Number}

in          ‘SOP Status’     IN_Start_SOP_Status,   {the starting SOP Status}

                                    IN_End_SOP_Status;    {the ending SOP Status}

in          integer              IN_Doc_Sort;                {1=document number, 2=customer}

in          integer              IN_File_Source; {SOP_DiSPLAY_WORK or SOP_DISPLAY_HISTORY}

in          integer              IN_Match_Packing_Slip;            {from SOP_SETP}

in          integer              IN_Match_Picking_Ticket;          {from SOP_SETP}

in          boolean                        IN_Print_PS_Line_Comments;    {include line comments on packing slips?}

in          boolean                        IN_Print_PT_Line_Comments;    {include line comments on picking tickets?}

in          boolean                        IN_Print_PS_Per_Site;   {print separate packing slips for each site?}

in          boolean                        IN_Print_PT_Per_Site;    {print separate picking tickets for each site?}

in          boolean                        IN_ReprintPS;               {reprint packing slip if already printed?}

in          boolean                        IN_ReprintPT;                {reprint picking ticket if already printed?}

in          boolean                        IN_IncludeDSItems;       {print drop ship items on packing slip?}

in          boolean                        IN_IncludeBackOrderedItems; {print backordered items on document?}

in          boolean                        IN_Print_Kit_Components;         {include kit components?}

in          boolean                        IN_Include_Tax_Details; {include taxes on the documents?}

in          boolean                        IN_Print_Dual_Currencies;          {Print Originating and Func currency?}

in          integer              IN_Tax_Print_Options;   {0 = line item and summary, 1 = summary only}

in          boolean                        IN_Print_Inclusive_Tax;              {Print Amounts Inclusive of Tax}

in          boolean                        IN_Print_Tax_Invoice;                {Print Tax Invoices}

in          boolean                        IN_Print_Adjustment_Note;        {Print Adjustment Notes}

in          boolean                        IN_Print_Prev_Printed;   {print documents already printed?}

in          integer              IN_Format[8];                {the format of the different document types}

in          boolean                        IN_Print_Doc[9];                        {should each document type be printed?}

in          boolean                        IN_Screen[9];                {should each document type be printed to the screen?}

in          boolean                        IN_Printer[9];                 {should each document type be printed to the printer?}

in          integer              IN_Export[9];                 {export type for each document type}

in          string                IN_Filename[9];             {generic export filename for each document type}

in          integer              IN_Which_Currency;     {1 = originating, 2 = functional}

in          ‘Sequence Number’       nSeqNum;         {Used to cleanup reports that are deleted from the

process monitor}          

in          boolean                        IN_Print_Customer_Item_Document; {Print customer item number on doc?}

in          boolean                        IN_Print_Picking_Instructions;    { Print picking instructions on Picking ticket?}

in          boolean                        IN_Include_Kit_Components_PT; {Print kit components on picking ticket?}

in          boolean                        IN_Bin_Sequened;                     {Sort picking ticket by bins?}

in          boolean                        IN_Sort_Kit_Components;          {Sort components when bin sequenced}

in          boolean                        IN_Include_Kit_Components_PS; {Print kit components on packing slip?}

in          boolean                        IN_Print_Customer_Item_PS;     {Print customer item number on packing slip?}

in          boolean                        IN_Include_Incomplete_Documents_PT; {Include incomplete docs marked ship complete on picking ticket?}

in          boolean                        IN_Include_Incomplete_Documents_PS; {Include incomplete docs marked ship complete on packing slip?}

inout     ListObjState      ListObj;  {List object data needed for printing from lists}

in          boolean                        IN_Print; {can Print document}

in          boolean                        IN_SendEmail; {can Send Email}

optional inout    integer              nProcessID = 0;

optional inout    boolean                        fValidDocsToEmail = false;

Filed under: Dexterity Development, Dynamics GP, dynamics-gp

run script delayed- missing spell in VSTools C# Coding

In Sanscript coding we have few commands, functions or procedures which are not provided by VSTools, so even though many people are now using VSTools as a customization tool for Dynamics GP instead of VBA and Modifier combination, sometimes even small functionalities will become very difficult to achieve.

Few days back similar kind of issue was shared by a developer on the forum where objective was to open the Purchasing Detail Entry window, set specific value of ship to address and then close the window. Sounds simple!

But actually it was not that simple. The issue in the beginning was that when setting value of ship to address with code, it wouldn’t actually update the ship to address and on closing and reopening of window bring the default value which was setting up by the application, and custom code was not able to change the ship to address value.

So I tried some C# and after some back and forth of lines of codes, it was actually changing the field value perfectly.

Dynamics.Forms.PopPoVendorDetailEntry.PopPoVendorDetailEntry.PrimaryShiptoAddressCode.Focus();
Dynamics.Forms.PopPoVendorDetailEntry.PopPoVendorDetailEntry.PrimaryShiptoAddressCode.Value = "WAREHOUSE";
Dynamics.Forms.PopPoVendorDetailEntry.PopPoVendorDetailEntry.PrimaryShiptoAddressCode.ForceValidate(true);
Dynamics.Forms.PopPoVendorDetailEntry.PopPoVendorDetailEntry.PrimaryShiptoAddressCode.RunValidate();

But now the issue was to automatically save the record and close the window. So this time the task was not that easy and back and forth of lines of codes were not enough. 😀

The first thing which was tried is to RunValidate() for OK button, but it was actually not doing the complete task, it was closing the window but not saving the changes done by our earlier code for ship to address value. This Vendor Detail Entry window is a child window, so on save button it ask for confirmation if user really wants to save changes, this message pops when change flag of window gets true, so running two RunValidate() , one for ship to address field and another for okey button was messing up the code because of parallel running. In dexterity when we have to run two scripts we use delayed keywork so the delayed keyword then will delayed the called script to run and complete first before running the second script. But in VSTools there is no equivalent delayed keywork/function. So running two RunValidate was not doing what we needed

means RunValidate() — Ship to Address will run and complete the process

then RunValidate() — ok button will run and do the process.

Another issue was a pop up message, now we also have to close it automatically. After I tried many other things I thought why not use SendKey and close window calling OK button RunValidate(). It didn’t worked at first as still SendKey was running before Ship to address field RunValidate() gets finish its work. But then SendWait() slows down the things and made them perfect. And for pop up was handled by Modal Dialog events perfectly.

public class GPAddIn : IDexterityAddIn
    {
        // IDexterityAddIn interface
        public static Microsoft.Dexterity.Applications.DynamicsDictionary.PopPoVendorDetailEntryForm.PopPoVendorDetailEntryWindow popEntryDetailWindow = Dynamics.Forms.PopPoVendorDetailEntry.PopPoVendorDetailEntry;

        public void Initialize()
        {

           Dynamics.Forms.PopReceivingsEntry.OpenAfterOriginal += PopReceivingsEntry_OpenAfterOriginal;        
           Dynamics.Forms.PopPoEntry.PopPoEntry.VendorId.ValidateAfterOriginal += VendorId_ValidateAfterOriginal;  
           popEntryDetailWindow.BeforeModalDialog += PopEntryDetailWindow_BeforeModalDialog;
            
          
        }

        private void VendorId_ValidateAfterOriginal(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            Dynamics.Forms.PopPoEntry.PopPoEntry.ExpansionButton4.RunValidate();
            if (Dynamics.Forms.PopPoEntry.PopPoEntry.LocalStatus.Value == "New" || Dynamics.Forms.PopPoEntry.PopPoEntry.RevisionNumber.Value == 0)
            {

                Dynamics.Forms.PopPoVendorDetailEntry.PopPoVendorDetailEntry.PrimaryShiptoAddressCode.Focus();
                Dynamics.Forms.PopPoVendorDetailEntry.PopPoVendorDetailEntry.PrimaryShiptoAddressCode.Value = "WAREHOUSE";
                Dynamics.Forms.PopPoVendorDetailEntry.PopPoVendorDetailEntry.PrimaryShiptoAddressCode.ForceValidate(true);
                Dynamics.Forms.PopPoVendorDetailEntry.PopPoVendorDetailEntry.PrimaryShiptoAddressCode.RunValidate();

                SendKeys.SendWait("%{F4}");
            }
        }
private void PopEntryDetailWindow_BeforeModalDialog(object sender, BeforeModalDialogEventArgs e)
        {
            
            if (e.DialogType == DialogType.Ask)
            {
               
                if (e.Message.Contains("Do you want to save changes?"))
                {
                    e.Response = DialogResponse.Button1;
                }
            }
        }

Filed under: Dynamics GP, dynamics-gp, VSTools, ,

Long Integer “Out of rage”. :)

Unhandled script exception:
unhandled script exception: Long integer out of range. Results invalid. EXCEPTION_CLASS_SCRIPT_OUT_OF_RANGE SCRIPT_CMD_SET

Upgrade a source code of one of the customization on GL Transaction Entry window, and when tried to save record got error message “Long integer out of range”. There was not much code on the save button and on checking dexterity code it seems all was correct.

  • Stored procedure prototype – all set
  • Number of parameters – all set
  • Confirm from backend, stored procedure have same number of parameters – all set
  • JRNENTRY parameter data type is correctly defined as an Integer.
  • From front passing correct value, confirm with warning messages- all set
  • Then google the error and wend to link  

In the issue Cause it says

The account index value for the GL account in the PM Tax Work table (PM10500) is greater than the small integer value of 32767, which is the largest value a small integer field will allow. 

but I am not working on PM table,  Yes! but definitely working with integer value and here get back to my stored procedure prototype code and yes got the reason why long integer was out of rage and giving error messages, instead of defining it as long integer, I have defined it only integer. Changed it to long integer, compiled and apply the chunk and everything is working now smoothly.

Filed under: Dexterity Development, Dynamics GP, dynamics-gp

Converting modified reports/form from vba to Dexterity.

Because of various reasons people are replacing their vba code with dexterity or VSTools and often we got question like how to do this and that in VSTools or dexterity. The best thing to do while replacing your vba code is to hire someone having customization expertise. 😀

Yes , I am not kidding, I believe for someone who don’t have coding experience, even using coding tools are hectic. Since the arrival of web client for Dynamics GP we are reading discussions about moving vba code to other development tools, and sadly I saw people going for VSTools or Custom .NET application trying to do the same functionality with the help of eConnect or similar integration tools but never think about Dexterity for a second, ignoring the fact that moving all the customization on dexterity will let them free from future incompatibility and maintenance issues.

Call it a fear or a phobia, but it is not true that dexterity based customization crashes application, just like vba or VSTools if anything goes wrong you have always an option to go and disable the customization or completely remove it. Dexterity customization if you do changes in GP native windows then they will be inside your product dictionary (just like the vba FORMS and REPORTS dictionaries) and not actually update DYNAMICS dictionary, so by no means your native forms will get updated with dexterity customization.

So, in my opinion to get most out of your ERP, you need to choose your customization tool wisely and for long term and that native tools are always smarter than others.   🙂

 

 

 

Filed under: Dexterity Development, Dynamics GP

Protected: Microsoft Dexterity Triggers

This content is password protected. To view it please enter your password below:

Filed under: dynamics-gp,

Why Choose Dexterity for customization/modifications.

dexterity

Once upon a time More than one upon a time, client insist to not have customization in dexterity because they thinks it will cause issues, unknown errors, system crash and will require many more hours of coding and testing. In this case it was modifications of gp default reports like SOP and POP blank papers, short and long form etc, modification was to get some information from 3rd party/custom tables and print them on report,  so instead of suggestion to have this modification in dexterity they went for report writer modifications along with vba coding just to avoid the dexterity/chunk deployment. Years passed.

Then the issue came with some of their users using GP web client so vba was not working, workaround was to print reports from the regular GP installation and all was good.Again years passed.

Then client moved to windows server 2019 and all the sudden vba code stopped working because it is not supported by the OS. I also saw similar issue related questions on GP forum and people were asking for alternatives. Alternatives like moving vba customization to .Net or VSTools. Moving customization to VSTools is something one can go for if the customization is related to GP windows, but for reports modification looking for other option like designing custom reports in Crystal or SSRS is difficult to understand,  it has disadvantages of it’s own.

    • You have to design a complete new report.
    • You have to work for each format separately.
    • If GP default report is updating document status on printing then it means we will be missing those updates in relevant GP table.
    • You will miss wide variety of print options available on print options window.
    •  You will miss the beauty of report writer reports.
    • You need custom window for report selection and the lookups their will be not as friendly as gp lookups 🙂

But as dexterity sound more confusing to many people, People usually go for custom .Net utilities then dexterity.

sadly. : (

Filed under: dynamics-gp

Unable to resolve reference to Table, report package import

error import report

report error

Filed under: Dynamics GP, dynamics-gp

Protected: MDA For Microsoft Dynamics GP.

This content is password protected. To view it please enter your password below:

Filed under: dynamics-gp

An open operation on table ‘srcSpecs’ could not find a record.

Issue: When creating chunk by newly installed dexterity utilities, it was giving error on first step of open source dictionary. The source dictionary was the newly copied dictionary from the dynamics GP folder. Dexterity utility was open to successfully open old dictionaries but each time new dictionary was tried to open for new work it was giving error when trying to create chunk file of that dictionary.

uninstalled/reinstalled dexterity doesn’t solve the issue.Then I tried installing the same GP version and found that although GP installation was successful and it was giving message, one macro file was blocked by Anti-virus, since it was showing newly installed dynamics GP path, it was obvious that it’s not virus so I ignore it and move ahead.

once again tried creating chunk but got the same error. The I reinstalled dexterity again and tried once more time. This time Utility was able to open source file without any error.

 

 

 

Filed under: dynamics-gp

Enter your email address to follow this blog and receive notifications of new posts by email.

Blog Stats

  • 15,802 hits

Enter your email address to follow this blog and receive notifications of new posts by email.

3rd party database access 3180 adding CR in text field Adding NULL values in dropdown Adding Sample Company Data Adding Symbol to Currency fields Alternate Window Analytical Accounting Attachments cancel button Can I ... Carriage Return chunk CH_SPACE CMMTTEXT Cross Dictionary Dexterity Development Cross Dictionary Triggers Currency Symbol in Dynamics GP windows Damo Data for Dynamics sample company Datatype dex DEX.DIC dexterity Dexterity Currency field Dexterity Dropdown Dexterity finditem() Dexterity Triggers DEX_ROW_TS Dict_GetPathname() Dynamics GP Dynamics GP Posting Issues Finding GP Field finding specific field in tables Finding Table Focus Trigger FP: Script not found errors GETUTCDATE() great plains Grid How to identified product related to error. hyperspace Hyperspace property of dexterity field. Increasing Field Size of Dynamics GP Table INFORMATION_SCHEMA.COLUMNS Link Format Selector Microsoft Dynamics Error Modified Reports Modifier MOP_Order_MSTR Path_MakeNative() Path_SelectPathname() Posted receipts not showing on Enter Match Invoice window.Enter Match Invoice window. Project Accounting For Dynamics GP Reading Folder Redisplay Refill Report Destination Sales Transaction Entry Scroll Sanscript Saving Images Script Error Script Not Found Session access denied SmartList Favourites SQL Script to Find column in tables SQL_Execute SUSER_SNAME() TextFile_ReadLine() TextFile_WriteLine() The SELECT permission was denied on the object "XXX" transaction entry User access Using SQL in Dexterity VBA for Dynamics GP You may not edit this document . it is being edited by another user.

Enter your email address to follow this blog and receive notifications of new posts by email.

Blog Stats

  • 15,802 hits
Freddys blog

Learn something new... - then Teach someone!

حلقۂ دام خیال

عالم تمام حلقۂ دام خیال ہے

M@ria

~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

Ghostriver Studios Blog

Sculptural stained glass of Andrew Kosorok

Dynamics GP Builders & Reporting

How to use MS Dynamics SmartList Builder, Excel Report Builder and other Reporting tools to get the data and analysis you need.