SaveReportToIDM

You can use the SaveReportToIDM function in Optiva workflows to generate a report document using Crystal Reports and save the report directly to Infor Document Management (IDM) for an Optiva object with the specified IDM attributes.

When to use

You can use this function to:

  • Generate a report and store it directly in IDM instead of saving only to a file path.
  • Attach a generated report to a specific IDM document code.
  • Generate reports in PDF, Excel, MS Word, or HTML format from a Crystal Reports template and manage the reports in IDM.

When not to use

You cannot use this function when you only need to save the report to a file path without storing the report in ID.

Syntax

int SaveXMLSchema(string xmlFile, string outFile);

Parameters

Parameter Type Required Description
reportUrl string Yes The Optiva WebReport URL pointing to the web server hosting WebReports. Example: http://<machine_name>/FsWebReports/Launch.aspx
jobFileName string Yes The full path and filename of the XML file that contains the data to be reported.
objectSymbol (keysymbol) string Yes

The symbol of the object.

Note: You can use empty quotation marks ("") for the current workflow symbol.
reportType (reporttype) string Yes The output format. Possible values:
  • PDF
  • Excel
  • MS Word
  • HTML
reportPath string Yes The full path and filename of the Crystal Reports (.RPT) template to use for generating the report.
outputFilePath (outFile) string Yes The path and file name to which the report file will copy from temporary report path.
Note: You can use empty string "" if not needed.
debugMode string Optional Controls trace logging.
Note: You can use "TRACE" to create a log file, or empty string "".
IDMdocCode (funcCode) string Yes The IDM Document Code that determines which IDM document type the report will be attached to.
fileName (FileName) string Optional The name assigned to the report file for the File_Name IDM attribute.
Note: If an empty string is provided, the auto-generated temporary filename will be used instead.
IDMattributes (attributes) Dictionary<string, object> Yes The collection of IDM metadata attributes to associate with the document. Must include OPTIVA_SYMBOL, OPTIVA_SYMBOL_ID, and OPTIVA_DOC_TITLE.
Note: The additional attributes such as expiry_date can also be included depending on the IDM doc type.

Return Value

The application returns true if the operation is successful and false if the operation fails.

Prerequisites

  • The function generates Crystal Reports in PDF, Excel, MS Word, or HTML format.
  • The report is saved directly to IDM.
  • The IDM attributes OPTIVA_SYMBOL, OPTIVA_SYMBOL_ID, and OPTIVA_DOC_TITLE are required.
  • All file paths must be accessible from the Optiva server.

Examples

Example 1
Generate and attach report to Infor IDM.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using DocICP = Infor.DocumentManagement.ICPClass;

public class ActionScript : FcProcFuncSetEventWF
{
    public long wf_start()
    {
        string reportURL = "";
        string jobFileName = "";
        string objectSymbol = "";
        string reporttype = "";
        string docfilepath = "";
        string IDMdocCode;
        string fileName;
        string reportPath = "";
        string outputFilePath = "";
        string debugMode = "";
        Dictionary<string, object> IDMattributes;

        try
        {
            reportURL = "http://localhost/FsWebReports/launch.aspx";
            jobFileName = @"\\SERVERNAME\FsWebReports\Source\ReportTemplate.xml";
            objectSymbol = "FORMULA";
            reporttype = "pdf";
            reportPath = @"\\SERVERNAME\FsWebReports\Source\FsCRMSDS01.rpt";
            fileName = "Formula_Detail_RPT." + reporttype;
            outputFilePath = "";
            debugMode = "TRACE";
            IDMdocCode = "Report_Attach_Test";

            // IDM Attributes
            IDMattributes = new Dictionary<string, object>();
            IDMattributes.Add("OPTIVA_SYMBOL", objectSymbol);
            IDMattributes.Add("OPTIVA_SYMBOL_ID", "01010");
            IDMattributes.Add("OPTIVA_SYMBOL_VERSION", "0001");
            IDMattributes.Add("OPTIVA_DOC_TITLE", "A Test-" + DateTime.Now.ToString().Trim());

            // Assumes SaveReportToIDM is a method available on this class or a base class
            this.SaveReportToIDM(reportURL, jobFileName, objectSymbol, reporttype, reportPath, outputFilePath, debugMode, IDMdocCode, fileName, IDMattributes);
        }
        catch (Exception ex)
        {
            // Assumes Messagelist is defined on this class or a base class
            Messagelist("error :" + ex.Message);
        }

        return 111L;
    }
}