Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

How to include Catalog Variables when exporting RITM/SC Task records to Excel or CSV?

aparnaravi
Tera Contributor

Hi Team,

We have a requirement to include Catalog Variables when exporting RITM (sc_req_item) and SC Task (sc_task) records.

Currently, when we use the standard Export option (Excel/CSV) from either the list view or a single record, only the table fields are exported. The catalog variables are not included, as they are stored separately.

Our requirement is:

  • Export should include both the standard table fields (e.g., Number, State, Requested For, Opened By, etc.) and the catalog variables as additional columns.

  • Ideally, this should work when exporting a single RITM from the form as well as from the list view.

I understand that one approach is to build a custom "Export with Variables" solution using a UI Action and server-side script.

I have a few questions:

  1. Has anyone implemented a similar solution?

  2. What is the recommended approach to generate an Excel/CSV that includes both table fields and catalog variables?

  3. Is there any out-of-the-box functionality or existing API that supports exporting catalog variables along with the record details?

  4. If a custom solution is required, what would be the best practice for generating the export file?

Any suggestions, sample implementations, or best practices would be greatly appreciated.

Thank you

6 REPLIES 6

@aparnaravi 

you can use PDF Generation API

check this link which has script from Piyush

Generate PDF file for catalog variables and attach it to RITM 

you can check the PDF Generation API for this

Generating Custom PDFs - using the new PDFGenerationAPI

another method

Generate PDF and attach to the record

When catalog item is submitted, attach variables to RITM as a PDF 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Abhishek Pal
Kilo Guru

Hi aparnaravi,

Yes, this is expected for the standard list/form export.

Catalog variables are not physical columns on the Requested Item [sc_req_item] or Catalog Task [sc_task] tables. They are displayed through the Variable Editor formatter, and form PDF exports do not include formatter content.

However, an OOB solution is available for Excel, CSV, and tabular PDF exports.

Recommended OOB approach:

1. Navigate to Platform Analytics > Library > Data Visualizations and create a new List report.

2. Select the source table:

For RITMs:
Requested Item [sc_req_item]

For Catalog Tasks:
Catalog Task [sc_task]

3. Filter the report to a specific catalog item.

For RITMs:

Catalog item is <catalog item>

For Catalog Tasks:

Request item > Catalog item is <catalog item>

4. In Choose columns, add the required standard fields, such as:

Number
State
Requested for
Opened by
Catalog item
Assignment group
Assigned to

5. At the bottom of the available columns, expand:

Variables [+]

6. Select the relevant catalog item and add the required variables as report columns.

7. Save and run the report.

8. Export the report to Excel, CSV, or PDF.

For exporting a single RITM or Catalog Task, use the same report and add a filter such as:

Number is RITM0012345

or:

Number is SCTASK0012345

No custom UI Action is required when the catalog item and variable columns are known.

PDF clarification:

The standard form option:

Export > PDF

does not include the Variable Editor because it is a formatter rather than a table field.

For an OOB tabular PDF containing variables, export the list report after adding the variable columns.

If you require a formatted document-style PDF containing one record and all its variables, a custom solution is required. The recommended design is:

UI Action
-> Reusable Script Include
-> Retrieve the RITM and its variables
-> Generate the document using PDFGenerationAPI
-> Attach or download the generated PDF

For an SCTASK, retrieve the variables from its Request item reference because the task variables originate from the associated RITM.

Important limitations:

- Variable columns are selected for a specific catalog item.
- If multiple catalog items contain different variables, create separate reports or define a standardized export schema.
- Multi-row variable sets, attachment variables, and highly dynamic variable structures may require a custom export.
- Verify read access to the Options [sc_item_option], Variable Ownership [sc_item_option_mtom], and Variables [item_option_new] tables.
- Do not copy variable values into custom RITM fields only for reporting, as this duplicates data and creates maintenance overhead.

Therefore, the recommended order is:

Fixed catalog item and known variables
-> OOB List Report with Variable columns

Multiple catalog items with different variable structures
-> Separate reports or a controlled custom CSV export

Formatted single-record PDF
-> PDFGenerationAPI-based custom solution

References:

https://www.servicenow.com/docs/r/now-intelligence/reporting/create-list-rep-with-var-col.html

https://www.servicenow.com/docs/r/now-intelligence/reporting/use-service-catalog-variables-in-report...

https://www.servicenow.com/docs/r/api-reference/server-api-reference/PDFGenerationAPIBothAPI.html

Hope this helps!

If this response helped, please mark it as Helpful.
If it resolves your issue, please Accept it as Solution.

Kind Regards,
Abhishek Pal