Configure Run Report command

From Resco's Wiki
Revision as of 08:50, 4 March 2021 by Jzambor (talk | contribs) (Configuration string)
Jump to: navigation, search
Mobile reports
Warning Work in progress! We are in the process in updating the information on this page. Subject to change.

Resco mobile apps can generate mobile reports using data from the CRM. In the app, reports are usually initiated using the command Run Report. Since release 14.0, it is possible to configure the behavior of this command using the On Execute rule.

Configuration string

The configuration is stored as a JSON string with the following format:

{
    "formats": [
        "pdf",
        "word"
    ],
    "commands": [
        "save",
        "email",
        "openexternal"
    ],
    "autorun": true,
    "filter": "<fetch version=\"1.0\"><entity name=\"resco_mobilereport\"><filter type=\"and\"><filter type=\"and\"><condition attribute=\"statuscode\" operator=\"eq\" value=\"1\"/><filter type=\"and\"><filter type=\"and\"><condition attribute=\"name\" operator=\"like\" value=\"%{{Shared.sharedVar1}}%\"/></filter></filter></filter></filter></entity></fetch>",
    "reportId": "Account Report",
    "reportName": "Account Report {sharedVar1} {dummy1} {dummy2:yyMMdd_HHmmss} {modifiedon:yyMMdd_HHmmss}",
    "attachmentType": "annotation"
}

All fields in the configuration are optional and can be skipped. In that case, Resco Mobile CRM falls back to the default values.

formats
The list of allowed report formats. Supported values: Pdf, Html, Text, Word, Excel. Case insensitive. You can use * wildcard as the first and only item in the array to indicate that all formats are allowed. An empty array means no formats are allowed. Default is *.
commands
The list of allowed report commands (i.e., actions available for a complete report). Supported values: Save, eSignature, SendTo, View, OpenExternal, Print, Email, Copy, Export. Case insensitive. The * wildcard is supported the same way as with formats. Default is *.
autorun
Indicates if the report runs automatically or a user needs to explicitly execute it. Supported values: true, false. Default is false for regular entities and true for questionnaires.
filter
Serves to restrict the reports a user can choose from the dropdown menu. It is not required for default report as indicated by reportId to be included in fetch results, however, it is a good idea for consistency.
The fetch expression in XML format encoded as JSON compatible value. It must be for the resco_mobilereport entity.
The conditions in fetch can use placeholder values in format Template:Entity.fieldname or Template:Shared.variableName. Variable names are case-sensitive. Values are taken from the parent entity (the one on which the form is executed, e.g., Account or Questionnaire).
The default value is a fetch expression consisting only of automatically added conditions as described below.
The following conditions are automatically added to the fetch if not present in configured fetch.
  • resco_entityname = {name of parent entity} - ensures that only reports dedicated for the parent entity can be selected.
  • statuscode = 1 - ensures that only active reports can be selected.
  • resco_sourcetype = ReportSourceType.Both or ReportSourceType.Record - ensure that the right type of report based on how many source records there are.
  • resco_languagecode in [ -1, lcid ] - ensures that only reports for the current user's language and language-neutral reports can be selected.
Inspections only (resco_questionnaire entity)
  • resco_recordid = {ID of parent questionnaire's template} - ensures that only reports created for the template of parent questionnaire can be selected.
Note: By including your own conditions in the configured fetch you can make these filters more (or less) restrictive.
reportId
Identifies the report selected by default. Report Identifier (Guid) or Report name (string) can be provided. Default is no report for regular entities and automatic (embedded) report for questionnaires.
reportName
The output filename used for the generated report. The name can contain valid C# format string constructs referencing fields or shared form variables, e.g. Filename {modifiedon:yyMMdd_HHmmss}. Values are taken from the report's parent entity.
The default value is in format: {resco_mobilereport.name} {createdon:yyMMdd_HHmmss}
attachmentType
The name of the binary entity used for generated reports. The default value depends on the project configuration.

On Execute rule

Known limitations

  • The feature is available for reports on forms and questionnaires. It is not available from views.
  • The settings are ignored in the web version of Resco apps.