Issue: You create a custom report off of an existing report for a Work Order, Task, etc… and when you attempt to run the report you get hit with the following error:
Exception has been thrown by the target of an invocation.
Cause: An object was deleted from the report that is referenced in the reports script. Objects on our “Orders & Scheduling” reports differ from the SI5.5 Standard Reports and a few have scripts to generate the data. Some of the objects include (varies by report): Customer Address, Company Address, Proj, SONumber, etc.
Solution: If you are getting this error, you’ve already deleted the field(s) in the report so you must “comment out” the now “orphaned” script.
1. Open the report in question in the Orders & Scheduling Report Designer
2. Click the “Script” tab along the bottom of the interface:
3. Hopefully you remember what objects you deleted from the report. Look for lines of code that start with “ReportsUtilities.SetTextBoxValue” and find the ones that reference the names of the objects you deleted (in this example I deleted the “CompanyName” and “CompanyAddress” text boxes from a “Work Order by Location” report):
4. To comment out the script, simply type an apostrophe in front of the code. The text will turn green and be italicized:
5. Publish the report and it should run without throwing the error.
Note: On future reports, you may find it easier to simply not display a field on the report rather than delete it. To do this, select the object on the report and then in the Properties window change the value of “Visible” to “False”