boricua1213 4/11/2016 2:29:05 AM

Automate PM_Apply_To Maintenance form

Hello all,

 I have data on invoices and payments in another system that I need to create the applies to. Documents already exists in GP and are posted. Using VS for GP, I am able to fill VendorID and Docnumber of payment. This fills scroll window. I need to loop through each line of scroll window get the Docnumber see if it's one that I have to apply an amount, if so then fill the Apply amount cell, go on to next line.

I am having trouble getting the doc number of line and looping through. any ideas how to get doc number? What field name is it? I tried using VS classes and running Dynamics Continuum.

 Thank you in advance.

Here is some code I have. It's a bit of a mess cause I'm just doing trial and error at this point my apologies.

 

01.    string errMsg;
02.    short err=0;
03.    string doc;
04. 
05.    const string scrollWinName = "PM_Applied_Document_Scroll";
06.    const string FormName = "PM_Apply_To_Maintenance";
07. 
08.    Dynamics.Application compilerApp = (Dynamics.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Dynamics.Application"));
09.     
10.    Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.VendorId.Value = "STYLI002";
11.    Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.VendorId.RunValidate();
12. 
13.    Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.DocumentNumber.Value = "W00074165";
14. 
15.    Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.DocumentNumber.RunValidate();
16.   // Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.PmAppliedDocumentScroll.LocalAppliedAmount
17.    err = compilerApp.ExecuteSanscript(string.Format("focus field '(L) Applied Amount' of window '{0}' of form '{1}';", scrollWinName, FormName), out errMsg);
18.    var lineDocNumber = Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.PmAppliedDocumentScroll.DocumentNumber.Value;
19. 
20.    //err = compilerApp.MoveToField(string.Format("'(L) Applied Amount' of window '{0}' of form '{1}';", scrollWinName, FormName));
21.    Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.PmAppliedDocumentScroll.LocalAppliedAmount.Value = 50;
22.    Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.PmAppliedDocumentScroll.LocalAppliedAmount.RunValidate();
23. 
24.    err = compilerApp.ExecuteSanscript("Window_ScrollScrollingWindow(window 'PM_Applied_Document_Scroll' of form 'PM_Apply_To_Maintenance', SCROLLTYPE_NEXT);", out errMsg);
25. 
26.    if (err != 0)
27.        MessageBox.Show(string.Format("{0}  {1}", err, errMsg));
28. 
29.    //Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.PmAppliedDocumentScroll.DocumentNumber.Focus();
30.    //doc = Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.PmAppliedDocumentScroll.DocumentNumber.Value;
31.    //Microsoft.Dexterity.Applications.Dynamics.Forms.PmApplyToMaintenance.PmApplyDocument.PmAppliedDocumentScroll.ActualApplyToAmount.Value = 100;
32.                 
33.    //err = compilerApp.ExecuteSanscript(string.Format("focus field 'Document Number' of window '{0}' of form '{1}';", scrollWinName, FormName), out errMsg);
34.    //err = compilerApp.MoveToField(string.Format("'Document Number' of window '{0}' of form '{1}';", scrollWinName, FormName));
35.    //doc = compilerApp.GetDataValue(string.Format("'Document Number' of window '{0}' of form '{1}'", scrollWinName, FormName));
36.    //err = compilerApp.ExecuteSanscript(string.Format("run script 'Document Number' of window '{0}' of form '{1}';", scrollWinName, FormName), out errMsg);
37. 
38.     
39. 
40.    //err = compilerApp.ExecuteSanscript(string.Format("focus field 'Actual Apply To Amount' of window '{0}' of form '{1}';", scrollWinName, FormName), out errMsg);
41.    //err = compilerApp.SetDataValue(string.Format("'Actual Apply To Amount' of window '{0}' of form '{1}'", scrollWinName, FormName), "100.00");
42.    //err = compilerApp.ExecuteSanscript("Window_ScrollScrollingWindow(window 'PM_Applied_Document_Scroll' of form 'PM_Apply_To_Maintenance', SCROLLTYPE_NEXT);", out errMsg);
43. 
44.    //if (err != 0)
45.    //    MessageBox.Show(errMsg);
46.}

 

 

 

 

Version: GP 2015
Section: Dynamics GP, Visual Studio Tools for Dynamics GP


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3