Configure Run Report command: Difference between revisions
| (14 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{Report TOC}} | {{Report TOC}} | ||
[[Resco mobile apps]] can generate [[mobile Reports|mobile reports]] using data from the CRM. In the app, reports are usually initiated using the [[command editor|command]] '''Run Report'''. Since [[Releases/Spring 2021|release 14.0]], it is possible to configure the behavior of this command using the '''On Execute''' rule. Since [[Releases/Autumn_2021|release 14.2]], you can configure this directly in command properties. | [[Resco mobile apps]] can generate [[mobile Reports|mobile reports]] using data from the CRM. In the app, reports are usually initiated using the [[command editor|command]] '''Run Report'''. | ||
* Since [[Releases/Spring 2021|release 14.0]], it is possible to configure the behavior of this command using the '''On Execute''' rule. | |||
* Since [[Releases/Autumn_2021|release 14.2]], you can configure this directly in command properties. | |||
* Since app version 16.0.2 and JSBridge.js version 16.0, you can use the configuration in JavaScript. | |||
* Since [[Releases/Summer 2023|release 16.1]], you can save reports to a file column (Dataverse). | |||
== Configure in command properties == | == Configure in command properties == | ||
[[File:Advanced report config.png|alt=advanced report config overview|right]] | |||
# | # Do one of the following to start the [[command editor]]: | ||
#* In Woodford, edit a form, then click '''Commands'''. | |||
#* In the Questionnaire Designer, edit a questionnaire, then click '''Edit'''. | |||
# Add the Run Report command to the list of selected commands. | # 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 new command and click '''Properties''', then click '''Advanced report configuration'''. | ||
| Line 11: | Line 17: | ||
#* Enter '''Output file name''' if you want to control how the report file is named. | #* 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 '''Save report to entity''', select the entity where the report file is saved. | ||
#* Select which report formats should be available in the app. | #* Select which report formats should be available in the app. | ||
#* Select which commands should be available for a generated report. | #* Select which commands should be available for a generated report. | ||
#* As '''Action after report generation''' (or '''Immediate action'''), select "Save and close" if you want to save the report automatically after generation. Users can opt to view the 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 '''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. | #* Enable '''Automatically save signed reports''' to automatically save reports signed by all parties. | ||
# Click '''OK''' and save all changes. | # Click '''OK''' and save all changes. | ||
== Configure via | == Configure via rules/JSBridge == | ||
As an alternative to the command properties, you can pass the configuration string in an On Execute rule. | As an alternative to the command properties, you can pass the configuration string in an [[On Execute]] rule or in [https://github.com/Resconet/JSBridge/wiki/MobileCRM.MobileReport MobileCRM.MobileReport] object. | ||
=== Configuration string === | === Configuration string === | ||
| Line 41: | Line 47: | ||
"reportId": "Account Report", | "reportId": "Account Report", | ||
"reportName": "Account Report {sharedVar1} {dummy1} {dummy2:yyMMdd_HHmmss} {modifiedon:yyMMdd_HHmmss}", | "reportName": "Account Report {sharedVar1} {dummy1} {dummy2:yyMMdd_HHmmss} {modifiedon:yyMMdd_HHmmss}", | ||
"attachmentType": "annotation" | "attachmentType": "annotation", | ||
"immediateAction": "None" / "SaveAndClose" | "immediateAction": "None" / "SaveAndClose" | ||
} | } | ||
| Line 78: | Line 84: | ||
;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. <code>Filename {modifiedon:yyMMdd_HHmmss}</code>. Values are taken from the report's parent entity. | ;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. <code>Filename {modifiedon:yyMMdd_HHmmss}</code>. Values are taken from the report's parent entity. | ||
:The default value is | :The default value is a combination of the name of the mobile report and the current time, formatted to <code>{time:yyMMdd_HHmmss}</code>. | ||
;attachmentType: The name of the binary entity used for generated reports. The default value depends on the project configuration. | ;attachmentType: The name of the binary entity used for storing generated reports. The default value depends on the project configuration.<br>Since [[Releases/Summer 2023|release 16.1]], if you are running the report from a form, you can save it to a [[file column]] of the form entity. | ||
;autosavesigneddoc: Indicates whether a report should be automatically saved when users sign it. Supported values: <code>true</code>, <code>false</code>. Default is <code>true</code>. | ;autosavesigneddoc: Indicates whether a report should be automatically saved when users sign it. Supported values: <code>true</code>, <code>false</code>. Default is <code>true</code>. | ||
| Line 89: | Line 95: | ||
=== On Execute rule === | === 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. | 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. | ||
{| | {| | ||
| [[File:On execute rule for run report command on Account entity.png|400px]] | | [[File:On execute rule for run report command on Account entity.png|alt=Advanced report config: example of configuration string for Account entity|400px]] | ||
| [[File:On execute rule for run report command on Questionnaire.png|400px]] | | [[File:On execute rule for run report command on Questionnaire.png|alt=Advanced report config: example of configuration string for Questionnaire entity|400px]] | ||
|- style="text-align: center;" | |- style="text-align: center;" | ||
| On execute rule for the Account entity <br>(in [[Woodford]]) | | On execute rule for the Account entity <br>(in [[Woodford]]) | ||
| Line 104: | Line 110: | ||
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., <code>C8735473-FFA8-4D87-AF7B-F4B6C7CFECEA,annotation</code>). To maintain backward compatibility (avoid crashes) with MobileCRM 13.3 and earlier, it is needed to start configuration string with two commas, e.g. <code>,,{ "formats": ["pdf", "word"], "commands" : ["save", "email", "openexternal"], ... }</code>. | 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., <code>C8735473-FFA8-4D87-AF7B-F4B6C7CFECEA,annotation</code>). To maintain backward compatibility (avoid crashes) with MobileCRM 13.3 and earlier, it is needed to start configuration string with two commas, e.g. <code>,,{ "formats": ["pdf", "word"], "commands" : ["save", "email", "openexternal"], ... }</code>. | ||
=== Script example === | |||
Use the new function showFormWithConfiguration of the [https://github.com/Resconet/JSBridge/wiki/MobileCRM.MobileReport MobileCRM.MobileReport] object to take advantage of the JSON configuration. Note that when used in JavaScript, the fetch filter needs an additional backslash to properly escape the characters (two backslashes instead of one). | |||
<syntaxhighlight lang="js"> | |||
function showReportDialog() { | |||
MobileCRM.UI.EntityForm.requestObject(function (entityForm) { | |||
var report = new MobileCRM.Reference("resco_mobilereport", "012f0a8c-547f-42e5-a8f3-67abb7767969"); | |||
var ref = new MobileCRM.Reference("account", entityForm.entity.id); | |||
var params = '{ "formats": ["pdf"], "commands": ["save", "email"], "autorun": false, "reportName": "Account Report", "filter": "<fetch version=\\"1.0\\"><entity name=\\"resco_mobilereport\\"><filter type=\\"and\\"><condition attribute=\\"name\\" operator=\\"like\\" value=\\"test2\\"/></filter></entity></fetch>", "reportId": "test2", "attachmentType": "annotation", "immediateAction": "None" }'; | |||
MobileCRM.MobileReport.showFormWithConfiguration(report, [ref], null, params, MobileCRM.bridge.alert, null); | |||
}, MobileCRM.bridge.alert, null); | |||
} | |||
</syntaxhighlight> | |||
== Saving reports to file column (Dataverse) == | |||
The Run Report command can store the generated document in [[file column]]s belonging to the source report entity. The columns can be selected in the '''Save report to entity''' field. | |||
; Prerequisites: | |||
* Both the File Column and its Filename fields must be enabled in Woodford. | |||
* The parent entity form must contain a file column. | |||
;Notes: | |||
* Saving the document in the report dialog will only store it in a file column field of the parent form. The report is saved with the parent form. This applies even when '''Immediate Action''' is set to "SaveAndClose". | |||
;Limitations: | |||
* Digital signature flow (DocuSign) via eSignature command is not supported with File Columns. | |||
* Only applicable for Run Report Command on entity forms. Storing reports from on Views and Questionnaires is not supported. | |||
== Report commands == | |||
In the '''Commands''' section of the report configuration, you can set up which commands are available in the app. Some of the commands are platform-specific or are only visible if special requirements are met, for example: | |||
* '''Send to''' in only available on Android. | |||
* '''E-mail''': Availability depends also on the app's [[Setup#PIM|setup]]. If you set '''Send Emails Via''' to "CRM server", make sure that the user has rights to create records for the email and attachment (activitymimeattachment) entities. | |||
[[File:Commands-on-the-report-form.png|alt=run mobile reports: hamburger commands|300px]] | |||
== Known limitations == | == Known limitations == | ||
| Line 109: | Line 153: | ||
* The settings are ignored in the web version of Resco apps. | * The settings are ignored in the web version of Resco apps. | ||
{{Feedback}} | |||
[[Category:Woodford]] | [[Category:Woodford]] | ||
Latest revision as of 08:38, 2 October 2025
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.
- Since app version 16.0.2 and JSBridge.js version 16.0, you can use the configuration in JavaScript.
- Since release 16.1, you can save reports to a file column (Dataverse).
Configure in command properties

- Do one of the following to start the command editor:
- In Woodford, edit a form, then click Commands.
- In the Questionnaire Designer, edit a questionnaire, then click Edit.
- 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.
- Select which report formats should be available in the app.
- Select which commands should be available for a generated report.
- As Action after report generation (or Immediate action), select "Save and close" if you want to save the report automatically after generation. Users can opt to view the 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 rules/JSBridge
As an alternative to the command properties, you can pass the configuration string in an On Execute rule or in MobileCRM.MobileReport object.
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 a combination of the name of the mobile report and the current time, formatted to
{time:yyMMdd_HHmmss}.
- attachmentType
- The name of the binary entity used for storing generated reports. The default value depends on the project configuration.
Since release 16.1, if you are running the report from a form, you can save it to a file column of the form entity.
- 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"], ... }.
Script example
Use the new function showFormWithConfiguration of the MobileCRM.MobileReport object to take advantage of the JSON configuration. Note that when used in JavaScript, the fetch filter needs an additional backslash to properly escape the characters (two backslashes instead of one).
function showReportDialog() {
MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
var report = new MobileCRM.Reference("resco_mobilereport", "012f0a8c-547f-42e5-a8f3-67abb7767969");
var ref = new MobileCRM.Reference("account", entityForm.entity.id);
var params = '{ "formats": ["pdf"], "commands": ["save", "email"], "autorun": false, "reportName": "Account Report", "filter": "<fetch version=\\"1.0\\"><entity name=\\"resco_mobilereport\\"><filter type=\\"and\\"><condition attribute=\\"name\\" operator=\\"like\\" value=\\"test2\\"/></filter></entity></fetch>", "reportId": "test2", "attachmentType": "annotation", "immediateAction": "None" }';
MobileCRM.MobileReport.showFormWithConfiguration(report, [ref], null, params, MobileCRM.bridge.alert, null);
}, MobileCRM.bridge.alert, null);
}
Saving reports to file column (Dataverse)
The Run Report command can store the generated document in file columns belonging to the source report entity. The columns can be selected in the Save report to entity field.
- Prerequisites
- Both the File Column and its Filename fields must be enabled in Woodford.
- The parent entity form must contain a file column.
- Notes
- Saving the document in the report dialog will only store it in a file column field of the parent form. The report is saved with the parent form. This applies even when Immediate Action is set to "SaveAndClose".
- Limitations
- Digital signature flow (DocuSign) via eSignature command is not supported with File Columns.
- Only applicable for Run Report Command on entity forms. Storing reports from on Views and Questionnaires is not supported.
Report commands
In the Commands section of the report configuration, you can set up which commands are available in the app. Some of the commands are platform-specific or are only visible if special requirements are met, for example:
- Send to in only available on Android.
- E-mail: Availability depends also on the app's setup. If you set Send Emails Via to "CRM server", make sure that the user has rights to create records for the email and attachment (activitymimeattachment) entities.
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.
{{#CI form: title = Was this information helpful? How can we improve?
| type = inputs
| [textarea]
}}