back to top

Exporting a Report to a PDF and Attaching to a Record in Server-Side Code in Infor CRM (Saleslogix)

I recently had a client that needed to use server-side code to export a report to a PDF and add as an attachment to a record. There’s some tricky code to do this, so I decided to wrap it up in a reusable and open source assembly.

Take a look at the open source FX.ReportUtility repository on Github:
https://github.com/CustomerFX/FX.ReportUtility

Announcing the FX.ReportUtility Assembly

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 FX.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. There are two public methods, CreateAttachment and SaveAsPDF. Both will take a Crystal RecordSelection Formula.

The RecordSelectionFormula parameter must be a valid Crystal record selection formula. Examples:

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’)”

To save the report PDF as an attachment record. The CRMReport class constructor takes the report name. Then, the CreateAttachment you’ll pass, at minimum, a Crystal RecordSelection formula.

// export a report to a PDF and save as an attachment
var report = new FX.ReportUtility.CRMReport("System:My Report");
// 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("{ACCOUNT.ACCOUNTID} = '" + someAccountId + "'");
attachment.AccountId = someAccountId;
attachment.Save();

Or, to just export the report to a PDF:

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

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.

Get the FX.ReportUtility Assembly

You can grab the entire source code and assembly from Github or download just the compiled assembly below:

Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Ryan Farley
Ryan Farleyhttps://customerfx.com/article/author/ryanfarley/
Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Infor CRM SLX 10.0: Delegate Ownership Changes for “Everyone” Records

Learn how the new EveryoneOwnerAssignment secured action in Infor CRM SLX 10.0 allows designated users to change ownership of Everyone-owned records without requiring Administrator access.

Related Articles

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Related Videos