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.
}