Jump to content

Communication with external applications: Difference between revisions

From Resco's Wiki
No edit summary
Marek Rodak (talk | contribs)
 
(13 intermediate revisions by one other user not shown)
Line 12: Line 12:
* [https://en.wikipedia.org/wiki/Mobile_deep_linking Mobile deep linking] on Wikipedia
* [https://en.wikipedia.org/wiki/Mobile_deep_linking Mobile deep linking] on Wikipedia


=== Example of the URL scheme ===
== Example of the URL scheme ==


To open a specific record in Resco Mobile CRM app from other external application, it is possible to use this URL scheme link:
To open a specific record in Resco Mobile CRM app from other external application, it is possible to use this URL scheme link:
Line 20: Line 20:


An alternative URL for Android (which works from e.g. email apps) is:
An alternative URL for Android (which works from e.g. email apps) is:
  <nowiki>http://resco.net/schemes/mobilecrm?{entity_logicalname};{entity_id}</nowiki>
  <nowiki>https://resco.net/schemes/mobilecrm?{entity_logicalname};{entity_id}</nowiki>


{{Note|The record that the URL scheme is pointing to must be available in Mobile CRM app’s offline database.}}
{{Note|The record that the URL scheme is pointing to must be available in Mobile CRM app’s offline database.}}
=== Windows 7 app: Open in background ===
For the Windows 7 version of the app, it is possible to use the host "stayinbkg" instead of "open". In this case, the record is displayed in the app but the app does not gain focus, it stays in the background.
mobilecrm://stayinbkg?{entity_logicalname};{entity_id}
On other platforms, keeping the app in the background is not possible. The behavior is the same as with the host "open", or the link doesn't work at all.
== Custom URL scheme ==
If you're using [[Resco CRM server]] as your CRM server, you can set a custom URL/URI scheme in the [[Admin Console]].
== Emailing links ==
URL schemes are also used to send a mail message linking to a particular record from the app to other users. Recipients can use the link to start Resco Mobile CRM and immediately display the linked record.
=== Configuring in Woodford ===
You must add the command for sending links to your form or view (or both).
# Edit an [[app projects|app project]] in [[Woodford]].
# Select an entity, then click '''Show UI''' to display the list of views, forms, and charts.
# Add to forms:
#* Double-click a form to open the form designer.
#* Click '''Edit''' to display the list of available [[form commands]].
#* Add '''EmailLink''' to the '''Selected Commands''' pane, then click '''Save & Close''' twice.
# Add to views:
#* Double-click a view to open the form designer.
#* Click '''Buttons''' to display the list of available [[View#Buttons|row buttons]].
#* Add '''EmailLink''' to the '''Selected Commands''' pane, then click '''Save & Close''' twice.
# Publish your project.
=== Sending out the link ===
Depending on your Woodford configuration, you have two options how to send out a link:
* On your view, use the row button '''e-mail a link'''. If you have too many row buttons defined, you must first tap '''action''' and then select '''e-mail a link''' from a list of available actions. See [[View#Buttons|Buttons]] for more information about buttons.
* On your form, use the [[File:Email a link.png]] button in the top right corner. If you have too many form commands defined, you can select the action from the hamburger menu.
In either case, an email message is generated with three versions of the link, one for each environment:
* Web link for use in a web browser (<code><nowiki>https://build.rescocrm.com/...</nowiki></code>; experimental)
* iOS/Windows link (<code>mobilecrm://open?...</code>)
* Android link (<code><nowiki>https://resco.net/schemes/mobilecrm?...</nowiki></code>)


=== Configuration of Android devices ===
=== Configuration of Android devices ===
Line 28: Line 67:
On Android devices, you can configure what should happen when a link is clicked. Go to '''Settings > Apps & Notifications > Default Apps > Opening links'''. Tap the name of a Resco mobile app, for example MobileCrm.
On Android devices, you can configure what should happen when a link is clicked. Go to '''Settings > Apps & Notifications > Default Apps > Opening links'''. Tap the name of a Resco mobile app, for example MobileCrm.
* Under '''Supported links''', you should see <code>resco.net</code>.
* Under '''Supported links''', you should see <code>resco.net</code>.
* Under '''Open supported links''', verify that the option '''Ask every time''' is selected.
* Under '''Open supported links''', verify that the option '''Open in this app''' or '''Ask every time''' is selected.


=== Custom URL scheme ===
=== Caveats ===
If you're using [[Resco CRM server]] as your CRM server, you can set a custom URL/URI scheme in the [[Admin Console]].
 
* In case of the iOS/Windows link (starting with "mobilecrm"), many email applications perform overzealous sanitizing and strip the hyperlink. In this case, recipients receive just plain text, but not a link.
** The default iOS email app displays the link correctly, but the Outlook app or Gmail does not.
** As a workaround, recipients can copy the text and paste it into a web browser, then select a Resco app to open the link.
* The Android link may look like a classic HTTPS link, however, it simply redirects you to Resco.net webpage when opened in a web browser. On Android devices the link works correctly, assuming the device is properly configured as described in the previous section.
 
== Example: Open record in Resco Mobile CRM from Dynamics ==
 
The following example shows how to add a button to the Account form on Dynamics that opens the same record in Resco Mobile CRM.
 
<ol>
<li>In Dynamics, create and publish a new HTML web resource with the following script for a simple button that dynamically opens the corresponding Account record in Resco app:
 
<syntaxhighlight lang="html">
<html><head>   
<script type="text/javascript">
    function openRescoApp() {               
        var accountId = window.parent.Xrm.Page.data.entity.getId();
        accountId = accountId.slice(1, -1);
        var url = "mobilecrm://open?account;" +accountId;
 
        window.location = url;
    }
    </script>
<meta charset="utf-8">           
<meta></head>
<body onfocusout="parent.setEmailRange();" style="overflow-wrap: break-word;">
    <button onclick="openRescoApp()">Open Resco Mobile CRM App</button>
</body></html>
</syntaxhighlight>
</li>
<li>In Dynamics, add this web resource on the Account entity form, then save and publish the changes.</li>
<li>In Dynamics, go to Accounts and open any account record. Note the new button on the form.</li>
<li>Click '''Open Resco Mobile CRM App''' to open the record in Resco Mobile CRM.
</ol>
::[[File:Open resco mobile crm app.png|alt=Open record in Resco Mobile CRM from Dynamics showcase|600px]]


[[Category:Woodford]]
[[Category:Woodford]]

Latest revision as of 15:31, 14 November 2023

In some cases you might want to start a process in Resco Mobile CRM app, but continue in a third-party application. For this, you need to be able to

  • Send data from Resco app to the third-party app
  • Receive reply (data) from third-party app and process it in Resco app.

We support this kind of inter-application communication via URL schemes. The third-party application also has to support URL schemes to use this kind of data exchange.

We are using Offline HTML with JavaScript to accept the answer from the third-party application. It also requires that you use UI replacement or home screen replacement in the app (using the global function handleLaunch(parameter)).

See also:

Example of the URL scheme

To open a specific record in Resco Mobile CRM app from other external application, it is possible to use this URL scheme link:

mobilecrm://open?{entity_logicalname};{entity_id}

Where {entity_logicalname} represents the entity name (case sensitive) and {entity_id} represents the GUID of the record itself.

An alternative URL for Android (which works from e.g. email apps) is:

https://resco.net/schemes/mobilecrm?{entity_logicalname};{entity_id}
Note The record that the URL scheme is pointing to must be available in Mobile CRM app’s offline database.

Windows 7 app: Open in background

For the Windows 7 version of the app, it is possible to use the host "stayinbkg" instead of "open". In this case, the record is displayed in the app but the app does not gain focus, it stays in the background.

mobilecrm://stayinbkg?{entity_logicalname};{entity_id}

On other platforms, keeping the app in the background is not possible. The behavior is the same as with the host "open", or the link doesn't work at all.

Custom URL scheme

If you're using Resco CRM server as your CRM server, you can set a custom URL/URI scheme in the Admin Console.

Emailing links

URL schemes are also used to send a mail message linking to a particular record from the app to other users. Recipients can use the link to start Resco Mobile CRM and immediately display the linked record.

Configuring in Woodford

You must add the command for sending links to your form or view (or both).

  1. Edit an app project in Woodford.
  2. Select an entity, then click Show UI to display the list of views, forms, and charts.
  3. Add to forms:
    • Double-click a form to open the form designer.
    • Click Edit to display the list of available form commands.
    • Add EmailLink to the Selected Commands pane, then click Save & Close twice.
  4. Add to views:
    • Double-click a view to open the form designer.
    • Click Buttons to display the list of available row buttons.
    • Add EmailLink to the Selected Commands pane, then click Save & Close twice.
  5. Publish your project.

Sending out the link

Depending on your Woodford configuration, you have two options how to send out a link:

  • On your view, use the row button e-mail a link. If you have too many row buttons defined, you must first tap action and then select e-mail a link from a list of available actions. See Buttons for more information about buttons.
  • On your form, use the button in the top right corner. If you have too many form commands defined, you can select the action from the hamburger menu.

In either case, an email message is generated with three versions of the link, one for each environment:

  • Web link for use in a web browser (https://build.rescocrm.com/...; experimental)
  • iOS/Windows link (mobilecrm://open?...)
  • Android link (https://resco.net/schemes/mobilecrm?...)

Configuration of Android devices

On Android devices, you can configure what should happen when a link is clicked. Go to Settings > Apps & Notifications > Default Apps > Opening links. Tap the name of a Resco mobile app, for example MobileCrm.

  • Under Supported links, you should see resco.net.
  • Under Open supported links, verify that the option Open in this app or Ask every time is selected.

Caveats

  • In case of the iOS/Windows link (starting with "mobilecrm"), many email applications perform overzealous sanitizing and strip the hyperlink. In this case, recipients receive just plain text, but not a link.
    • The default iOS email app displays the link correctly, but the Outlook app or Gmail does not.
    • As a workaround, recipients can copy the text and paste it into a web browser, then select a Resco app to open the link.
  • The Android link may look like a classic HTTPS link, however, it simply redirects you to Resco.net webpage when opened in a web browser. On Android devices the link works correctly, assuming the device is properly configured as described in the previous section.

Example: Open record in Resco Mobile CRM from Dynamics

The following example shows how to add a button to the Account form on Dynamics that opens the same record in Resco Mobile CRM.

  1. In Dynamics, create and publish a new HTML web resource with the following script for a simple button that dynamically opens the corresponding Account record in Resco app:
    <html><head>    
     <script type="text/javascript">
         function openRescoApp() {                
             var accountId = window.parent.Xrm.Page.data.entity.getId();
             accountId = accountId.slice(1, -1);
             var url = "mobilecrm://open?account;" +accountId;
    
             window.location = url;
         }
         </script>
    <meta charset="utf-8">             
    <meta></head>
    <body onfocusout="parent.setEmailRange();" style="overflow-wrap: break-word;"> 
        <button onclick="openRescoApp()">Open Resco Mobile CRM App</button>
    </body></html>
    
  2. In Dynamics, add this web resource on the Account entity form, then save and publish the changes.
  3. In Dynamics, go to Accounts and open any account record. Note the new button on the form.
  4. Click Open Resco Mobile CRM App to open the record in Resco Mobile CRM.
Open record in Resco Mobile CRM from Dynamics showcase