Eager to learn more about Resco technology? Take a one-minute survey and help us create better content for you.

Configure Run Report command

From Resco's Wiki
Jump to: navigation, search
Mobile reports

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": [
    "commands": [
    "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.

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 *.
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 *.
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.
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 {{Entity.fieldname}} or {{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.
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.
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}.
The name of the binary entity used for generated reports. The default value depends on the project configuration.
Indicates whether a report should be automatically saved when users sign it. Supported values: true, false. Default is true.
Note: This function requires Resco Mobile CRM 14.1 and later.

On Execute rule

A configuration string as detailed in the previous section can be used in the On Execute rule to configure the behavior of the Run Report command. You have to enter it in the ParamString field. This function is available for form commands and questionnaire commands.

On execute rule for run report command on Account entity.png On execute rule for run report command on Questionnaire.png
On execute rule for the Account entity
(in Woodford)
On execute rule for the Questionnaire entity
(in the Questionnaire Designer)
Step Command.Param Assign 1
The Param field is used to distinguish between the old and the new format of the ParamString. It is an integer and its value stands for the version of the configuration. The legacy value is 0, the new JSON format is 1.
Step Command.ParamString Assign ,,{ "formats"...}
This is where you enter the configuration string.

Note: Previous versions of MobileCRM (13.3 and older) relied on ParamString to only store Guid of default report and name of attachment entity in a comma-delimited string (e.g., C8735473-FFA8-4D87-AF7B-F4B6C7CFECEA,annotation). To maintain backward compatibility (avoid crashes) with MobileCRM 13.3 and earlier, it is needed to start configuration string with two commas, e.g. ,,{ "formats": ["pdf", "word"], "commands" : ["save", "email", "openexternal"], ... }.

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.