The following is a sample of a script to produce a report for an Accredo App. This report runs the AR Aged Trial Balance report. If a Sales Person is passed into the script as a ScriptArgs, the report is shown for the sales person.
Note: If you use a Private Customisation folder, reports should be in this folder.
FileName = TempFileName '"D:\Internal Web Service\AccredoSaturn\MyReport.pdf"
Dim Report as Object
Report = CreateObject("Accredo.ARAgedBalancesReport")
Report.Layout = "Aged Trial Balance"
Dim Salesperson as String, Code as String
If ScriptArgs.Count > 1 Then
Salesperson = ScriptArgs[1]
If (ScriptArgs.Count > 2) Then Code = ScriptArgs[2]
If Salesperson <> "" Then
Report.CustomerFilterSort.Filter = "(SalesPersonCode=""" & Salesperson & """)"
End If
End If
Report.Destination = "Disk file"
Report.FileName = FileName
Report.Run
Success = False
Dim Txt as Object
Txt = CreateObject("Accredo.TextFile")
Success = Txt.FileExists(FileName)
SetScriptReportResult(Success,Filename, "ARAged Trial Balance.pdf")