Notes on Dynamics 365 for Phones and Tablets app – Part 12 (Mobile Offline Capabilities and Limitations)


Check the other articles of this series.

In this post, we’d cover some of the limitations and capabilities of Dynamics 365 Mobile App (in offline mode)

  • Add Existing (n-n relationship) is not supported in mobile offline
Mobile App – Online Mobile App – Offline
  • Only System Views are available in offline mode.

“My Custom View” is public view which is available in online mode, but not in offline mode.

Mobile App – Online Mobile App – Offline
  • BPF is not available in offline mode.
Mobile App – Online Mobile App – Offline
  • Custom Ribbon Button are note available in offline mode
Mobile App – Online Mobile App – Offline
  • The mobile offline is only available in iOS and Android phone and tablet app. Below is the screenshot of Tablet App on Windows 10. There is no option for going offline.

  • The offline option in Phones App for Android

  • Business Rules work in Offline mode.
  • Plugins and workflows are not supported in Offline mode.
  • Use Xrm.WebApi.offline to perform CRUD operation offline.


Mobile App – Online Mobile App – Offline
  • Downloading offline updates can take a few minutes to an hour. (The user can still work online while the data is getting synced in the background)



  • Web Resource can be made available offline



Mobile App – Online Mobile App – Offline

The same web resource when defined within the sitemap gives a “No data available” message.


Mobile App – Online Mobile App – Offline

Thus, while designing a solution for Mobile Offline, we need to consider the above behavior of the mobile app.

Hope it helps..

Notes on Dynamics 365 for Phones and Tablets app – Part 11 (Mobile Settings)


Check the other articles of this series

In this post, we’d look at the different settings specific to the mobile app and their effect.

In the mobile app, navigate to Settings – Mobile Settings in Dynamics 365 for Phones app.

Below are the different settings available inside the mobile app.

Let us look at the behavior of each of these properties.

  • Offline Sync

Offline Sync option is only available for iOS and Android Devices

Enabling the offline sync option will start the sync process in the background and will download the data offline for the user. While sync is happening, users can keep working online.

After the offline data is downloaded users can enable the option “Work in offline mode” to work offline.

  • User content and location

This option allows users to take voice notes and attach it as an attachment to notes.

The location details can be used in the getCurrentPosition method of Xrm.Device

https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-device/getcurrentposition

  • Camera – Allow Access

It allows the user to take a picture through the camera and attach it to notes as an attachment.

To take Video and attach it to notes, both the below permissions are required

  • User Content and Location
  • Allow Access

  • Camera – Save photo to the library

This will save the picture taken through Camera in the Gallery. (doesn’t need User Content and Location permission)

  • Camera – Photo Resolution

It allows the user to specify the resolution of the picture taken through the camera.

Below were the findings of the size of the picture for different resolutions with different devices.

You can read more about the file size of the pics in mobile apps here

Thus we saw the different mobile settings available in the mobile app and their consequence.

Hope it helps..

Dynamics 365 for Phones and Tablets App posts


Notes on Dynamics 365 for Phones and Tablets app

Using Xrm.Device captureImage method to take a picture and attach it to notes.

Using Xrm.Device pickFile to attach files to notes

Fixed – You do not have any apps in this view error.

Upload files using SharePoint integration in mobile app

Calling SetWordTemplate from the custom ribbon button

Attachment to Notes in the mobile app

Notes on Dynamics 365 for Phones and Tablets app – Part 10 (Data Download Filter in Mobile Offline)


Check the other articles of this series

In the previous posts, we saw how to configure Mobile Offline Profile and how it works for the end-users in the device.

The number of records that can be downloaded for Mobile Offline for a particular entity (and its related entity) can be specified using the Data Download Filter of Mobile Offline Profile Item record.

The total data available offline to the user will depend on Entity (enabled for offline) + Organization Data Filter applied to it + Mobile Offline Profile + Security roles of that user

Navigate to Settings à Mobile Offline à Mobile Offline Profiles

Let us open the Contact Mobile Offline Profile Item that we had specified earlier.

The different options for Data download filter are

  1. All records

Here All records will apply no filtering and all the contact records will be downloaded offline for the configured user.

The one important point to remember is that à

The total entity records (contact in this case) downloaded will be governed by the Organization Data download filter for that entity, what we specify in the mobile offline profile (i.e. data download filter) will be applying further filtering to it.

For contact, the criteria specified is Status equal
to Active.

Organization Data Filter criteria would be modified on less than 10 days for most of the entities by default


So, for All Records, we will have all the active contact records downloaded offline.

On publishing the above mobile offline profile, for users in offline mode, all the active contacts will be available.

And no inactive contacts will be available as shown below.

  1. Other data filter

Through Other data filter, we can specify what records to be downloaded based on ownership.

Here we have just selected Download my records, which should result in only the active (coming from organization download data filter) contacts owned by the user to be downloaded.

Let us publish it.

After successful Publish, let us check the same in the Phone App.

The app shows only the active contact records owned by the user.

Active Contacts view for the same user in Web Application.

  1. Custom data filter

The custom data filter will allow us to define the filter using the Define Profile Item Entity Filter dialog box.

Clicking on Define Filter Rule opens the dialog box for us, wherein we can select the fields of the entity for defining the filter criteria and can group it. We cannot choose related entity fields there.

Here for testing, we have kept the criteria as role equals as the Decision-maker.

Now let us publish the change, and check the data for the user in the mobile app offline.

We just have just one record having a role as the Decision-maker.

Back in the mobile app, the user can see only that one record inside the app.

  1. Download related data only

This option allows us to download related entity data. E.g. with the above contact records, we want to download the related lead records only, for this we will create a new profile item for the lead entity.

Now back in the Contact profile, add an associated offline profile item and specify the Entity-relationship between contact and lead.

Let us publish this new profile.

The user can now select the contact record and can see the related lead record

What happens if we delete the Lead Mobile Offline Profile and only keep the Contact offline profile having the lead association to it?

We’d get the below error

What happens if we keep the contact and lead profile and delete the lead association in the contact offline profile?

This will allows us to publish the profile.

So, for contact we have

  • Org filter as active contacts.
  • Data download filter as – Custom Data filter as Role equals Decision maker.

And for lead we have

  • Org filter as active leads.
  • Data download filter as – Download related data only.

The result – only one contact record with a role as the decision maker will be available for the user.

No associated lead

And no leads

Let us add back the mobile offline profile item association record of the lead in the contact offline profile.

The result à only one active contact record having the role as a decision-maker, and only one associated lead record will be available for the user.

Thus we saw, how we can use Data Download Filter to define filtering, which would specify the total records that would be available to users offline, in the mobile app.

Hope it helps..

Using Xrm.Device pickFile to attach file to notes in Dynamics 365 for Phones and Tablet app


Check the other articles of this series

In the previous post we covered the captureImagemethod of Xrm.Device for taking picture and attaching it to notes.

In this post, we’d look into the pickFile method of Xrm.Device

pickFile works for both Web Client and Mobile Client unlike captureImage which is only works for Mobile Client (Dynamics 365 for Phone and Tablet app)

pickFile method of Xrm.Device allows us to select files from the computer (web client) (through FileDialog box) and images (gallery) in the case of mobile clients. (the exception being Windows Tablet App), which then can be attached to notes.

Here we have added a custom ribbon button named “Pick file and attach” on the Lead entity form.

In the case of Web Client, the File dialog box opens

In the case of Windows Tablet App also, the file dialog box opens.

For Phone App for Android (and iOS), users can select the existing image from the gallery.

On successful attachment of file/image to notes, the user is presented with the below message.

Users can refresh the timeline to see the attached file.

The sample code using the pickFile method


function PickFile(entityId) {

entityId = entityId.replace(/[{}]/g,'');
Xrm.Device.pickFile().then(

function (data) {

// attach the uploaded file as attachment to note
var entity = {};
entity.subject = "Sample Subject";
entity.documentbody = data[0].fileContent;
entity.filename = data[0].fileName;
entity.mimetype = data[0].mimeType;
entity.notetext = "Sample Text";

// lead entity sample
entity["objectid_lead@odata.bind"] = "/leads(" + entityId + ")";

Xrm.WebApi.online.createRecord("annotation", entity).then(
function success(result) {
var newEntityId = result.id;

var alertStrings = { confirmButtonLabel: "OK", text: "File successfully attached to note. Please refersh the timeline." };
var alertOptions = { height: 200, width: 300 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);

},
function (error) {
Xrm.Utility.alertDialog("Error occured while attaching file to notes. Please try again");
}
);

},
function (error) {
Xrm.Utility.alertDialog("Error occured while picking file. Please try again");
}
);
}

Add the Crm Parameter to pass the GUID of the record to the method.

Thus, using pickFile makes it easy for the end-user to capture and attach the file to notes through a click of a button.

Also check out the wonderful tool Notes Metadata Manager , which provides additional capabilities like adding metadata to the attachments, organise attachments using folder structure, drag and drop attachments, upload multiple attachments etc.

Hope it helps..

Using Xrm.Device captureImage to take picture using camera and attach it to notes in Dynamics 365 for Phones and Tablet App


Check the other articles of this series

captureImage method of Xrm.Device allows us to take the picture through the camera and work with that captured image in the code (in this post, we are saving the image in the notes as an attachment).

This method is only available for mobile apps.

Here we have added a custom ribbon button on the Lead entity form.

  • Capture and attach

The capture Image method will allow the user to capture an image using the device camera and attach it to the notes as shown below.

Clicking on “Capture and attach” ribbon button, opens the camera for the user to take the pic as shown below.

Clicking on OK will ask the user to choose the image editor.

Users can edit the image and click on done.

The dialog informs the user that images have been attached.

Users can refresh the timeline to see the attached image in notes.

If we try using the captureImage method inside the Dynamics 365’s web application, we get the below error, because it is only supported for mobile devices.

The method will throw the below error in case of Web Application

“Operation {0} is not supported by platform”

The sample code for captureImage


function CaptureImage(entityId) {

entityId = entityId.replace(/[{}]/g,'');

var imageOptions = {};
imageOptions.allowEdit = true;

Xrm.Device.captureImage(imageOptions).then(
function (data) {

// attach the captured image as attachment to note
var entity = {};
entity.subject = "Sample Subject";
entity.documentbody = data.fileContent;
entity.filename = data.fileName;
entity.mimetype = data.mimeType;
entity.notetext = "Sample Text";

// lead entity sample
entity["objectid_lead@odata.bind"] = "/leads(" + entityId + ")";

Xrm.WebApi.online.createRecord("annotation", entity).then(
function success(result) {
var newEntityId = result.id;

var alertStrings = { confirmButtonLabel: "OK", text: "Image successfully attached to note. Please refersh the timeline" };
var alertOptions = { height: 200, width: 300 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);

},
function (error) {

Xrm.Utility.alertDialog("Error occured while attaching image to notes. Please try again");
}
);

},
function (error) {
Xrm.Utility.alertDialog("Error occured while capturing image. Please try again");
}
);
}

Add Crm Parameter to pass the GUID of the record to the method

CaptureImage

Thus, using captureImage makes it easy for the end-user to capture and attach the image to notes through a click of a button.

To update an entity’s image, we can click on the image itself which will open up the dialog to either use the camera, upload image from the gallery, or revert it to the default image (in not default).

Also check out the wonderful tool Notes Metadata Manager , which provides additional capabilities like adding metadata to the attachments, organise attachments using folder structure, drag and drop attachments, upload multiple attachments etc.

Hope it helps..