back to top

ReportUtility Assembly

The ReportUtility Assembly allows you to easily export an Infor CRM report to a PDF from C# code. You can also save report PDFs as attachments to records in Infor CRM.

The FX.ReportUtility provides two public methods. One to export the report to a PDF and another that will export the report to a PDF and add as an attachment record.

Using the ReportUtility Assembly

To use the assembly, first you’ll need to add the DLL to the SupportFiles\Bin folder of the SlxClient portal. Next, you’ll just add the code where needed. The ReportUtility’s CRMReport class has two public methods, CreateAttachment (which exports the report to a PDF and attaches it to a record) and SaveAsPDF (which simply exports the report to a PDF file).

Once you create a CRMReport object (FX.ReportUtility.CRMReport), you’ll need to set a RecordSelectionFormula to filter the report for some specific record or records. The RecordSelectionFormula must be a valid Crystal record selection formula.

Attaching a Report as a PDF to a Record

// export a report to a PDF and save as an attachment
var report = new FX.ReportUtility.CRMReport("System:My Report");

// set a filter for the report to use a specific record in the report
report.RecordSelectionFormula = "{ACCOUNT.ACCOUNTID} = '" + someAccountId + "'";
// call CreateAttachment which returns an Attachment record, 
// which you'll need to set the references for the record it 
// is for and then save it
var attachment = report.CreateAttachment();
attachment.AccountId = someAccountId;
attachment.Save();

Exporting a Report as a PDF File

// export a report as a PDF 
var report = new FX.ReportUtility.CRMReport("System:My Report");
report.RecordSelectionFormula = "{ACCOUNT.ACCOUNTID} = '" + someAccountId + "'";
var exportedFile = report.SaveAsPDF();

The methods do have other options such as a specific path to save the report as, and name of the file, as well as adding a description to the attachment record.

Setting Report Prompts/Parameters

You can also set report “prompts” (parameters) as well.

// export a report as a PDF 
var report = new FX.ReportUtility.CRMReport("System:My Report");
// set report parameters 
report.SetParameter("AccountID", someAccountId);
report.SetParameter("ActivityDate", someDateValue);
// you can also set the record selection formula in conjunction with parameters
report.RecordSelectionFormula = "{ACTIVITY:USERID}= '" + someUserId + "'";
var exportedFile = report.SaveAsPDF();

Setting Crystal Record Selection Formulas

To filter the report for a specific record or records, you need to set a valid Crystal record selection formula in the RecordSelectionFormula property. Some examples include:

Example #1:
“{OPPORTUNITY.OPPORTUNITYID} = ‘” + someOpportunityId + “‘”

It can also be more complex, such as the following:

Example #2:
“{OPPORTUNITYQUOTE.OPPORTUNITYQUOTEID} = ‘” + someOpportunityQuoteId + “‘ AND {OPPORTUNITY_CONTACT.ISPRIMARY} = ‘T’ AND NOT ({PRODUCT.NAME} = ‘Custom Door Panel’ OR {PRODUCT.NAME} = ‘Custom Drawer Panel’)”

For more information on valid Crystal record selection formulas, refer to the Crystal Reports documentation.

Download ReportUtility Assembly

Download

Note: Source is also available on Github, visit the repository here.

The following articles will assist you in getting started

License

The FX.ReportUtility is licensed under the GNU v3.0 License. View the license details. No warranties are given or implied. Use as-is at your own risk.

Additional Add-ons for

Activity Customization Module

The FX.ActivityModuleJS is a javascript library module that provides simple, configurable customization to the activity and history dialogs & tabs in Infor CRM Web. The library allows for customizations to be easily configured with only minimal code.

Mail Queue Job

The Customer FX Mail Queue Job is a job for Infor CRM that implements an e-mail queue and allows sending e-mails by simply adding records to a MailQueue table.

Conditional SmartParts Module

The Conditional SmartParts Module is a configurable module for Infor CRM that allows you to specify SmartParts to show or hide based on values of an entity property.

Sublogix

Sublogix is a development tool that provides a single object model and repository for Infor CRM and allows you to work with objects instead of SQL queries. The purpose of Sublogix is to give you the ability to work with Infor CRM entity objects no matter what environment you’re in and allows you to more quickly create outside or stand alone applications that work with the Infor CRM data.

Subscribe to our Newsletter

Contact us to discuss your Creatio or Infor CRM SLX project so our team of experts can help make it a success