Thursday, 5 January 2012

Dynamics CRM 4.0 Mobile Express Read Only

For those who applied CRM 4.0 mobile express, know the limitations and lack of flexibility can cause management and usability issues. One of the limitations is not being able to run javascript. Fair enough a mobile version should be simple and light enough to be used on a 3G connections. However the main drawback is related with read-only fields, these will be editable on the mobile version, users are allowed to edit those fields, but this is if the users have the buttons to edit the records.

Another limitation is the security, the existing security roles are applied to mobile express access the same way are applied to the full version, you cannot set up granular permissions for the mobile view alone, users get the same level of access on both the mobile and full version, there is no distinction.

Challenged with the fact that custom javascript cannot be used on the mobile view, any hidden and read-only fields will behave like any other static forms, which means if the users click edit, or click create new record, they will be allowed to enter data on these fields. One of the questions your company may ask: can we make it read-only? since the security roles are the same, this cannot be done, out of the box.

To make it read-only we want to remove the buttons avaiable to the user, forcing the user just to read and navigate around. The way to do this, I've managed to identify the CSS files associated with the mobile view, and add a few lines of code with the CSS statement display: none; removing the buttons I want.

The files to be edited are located:
C:\Program Files\Microsoft Dynamics CRM\CRMWeb\_common\styles\mobile\

Open in a notepad the below two files and edit the following lines:
Entityform.css.aspx 

td.actionButton
{
width: 50%;
display: none;
}

input.editButton
{

display: none;
<% if (CrmStyles.IsRightToLeft) { %>
float: right;
<% } else { %>
float: left;
<% } %>
}
input.deleteButton
{
display: none;
<% if (CrmStyles.IsRightToLeft) { %>
float: left;
<% } else { %>
float: right;
<% } %>
}


Entityhome.css.aspx
#newrecord {
display:none;
}

 The above CSS code exists on the above files, we just adding the display: none; section to hide those CSS ID's and Class's

Adding/changing CSS code on these files, also allows you to manipulate the look-and-feel of the entire mobile page. Read the HTML source code and identify which CSS ID's and Class's that control the page layout and overwrite the CSS settings on the above files.

Hope this was useful :)

2 comments:

  1. Fantastic post!

    Microsoft should add these options by default!

    However I tried this for Dynamics CRM 2011, did an IISRESET but the buttons are still there :(

    ReplyDelete
    Replies
    1. Hi pmdci,


      Thanks for your comments, I have posted a new entry with the changes for Dynamics CRM 2011.

      Regards
      Nuno

      Delete