Configure Run Report command: Difference between revisions
No edit summary |
|||
| Line 48: | Line 48: | ||
All fields in the configuration are optional and can be skipped. In that case, Resco Mobile CRM falls back to the default values. | 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: <code>Pdf, Html | ;formats: The list of allowed report formats. Supported values: <code>Pdf, Html, Word, Excel</code>. Case insensitive. You can use <code>*</code> 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 <code>*</code>. | ||
;commands: The list of allowed report commands (i.e., actions available for a complete report). Supported values: <code>Save, eSignature, SendTo, View, OpenExternal, Print, Email, Copy, Export</code>. Case insensitive. The <code>*</code> wildcard is supported the same way as with formats. Default is <code>*</code>. | ;commands: The list of allowed report commands (i.e., actions available for a complete report). Supported values: <code>Save, eSignature, SendTo, View, OpenExternal, Print, Email, Copy, Export</code>. Case insensitive. The <code>*</code> wildcard is supported the same way as with formats. Default is <code>*</code>. | ||
Revision as of 10:04, 13 September 2021
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. Since release 14.2, you can configure this directly in command properties.
Configure in command properties
- On a form (in Woodford) or questionnaire (in Questionnaire Designer), click Edit to start the command editor.
- Add the Run Report command to the list of selected commands.
- Select the new command and click Properties, then click Advanced report configuration.
- Select the default (pre-selected) report, either by ID (and select the report from a list) or by name (and enter a name).
- If you have multiple reports defined and you want to make sure that users don't choose a wrong report, click Define filter and set which reports should be available with this button.
- Enter Output file name if you want to control how the report file is named.
- As Save report to entity, select the entity where the report file is saved.
- As Immediate action, select "SaveAndClose" to save the report automatically after generation. Users can opt to view the generated report.
- Select which report formats should be available in the app.
- Select which commands should be available for a generated report.
- Enable Auto run if you want the report generation start immediately after selecting the command in the app (skipping in-app configuration).
- Enable Automatically save signed reports to automatically save reports signed by all parties.
- Click OK and save all changes.
Configure via On Execute rule
As an alternative to the command properties, you can pass the configuration string in an 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"
"immediateAction": "None" / "SaveAndClose"
}
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, 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 isfalsefor regular entities andtruefor 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_mobilereportentity.
- 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.
- 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.
- autosavesigneddoc
- Indicates whether a report should be automatically saved when users sign it. Supported values:
true,false. Default istrue. - Note: This function requires Resco Mobile CRM 14.1 and later.
- immediateAction
- Use "SaveAndClose" to save the report automatically after generation. Users can opt to view the generated report. This function requires Resco Mobile CRM 14.2 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 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"], ... }.