{WorkAround}CRM 2013:Locking Read-only users from Form ribbon click

We wanted to restrict read only users on Form ribbon click. First we tried to restrict using form type but interestingly not in all cases where form comes read-only, form type was matching to read only in CRM 2013. Hence,We used following unsupported script in all ribbon buttons which we did not

want to allow Read-only users to use:

//Show error for read-only users
  if($(‘#titlefooter_statuscontrol’) != null)
  {
      if ($(‘#titlefooter_statuscontrol’).text() == “Read only”)
      {
      alert(“You do not have permission to peform this operation.”);
      return;
      }
  }

 

Hope it helps!

{WorkAround}Dynamic URL in Email using Workflow in CRM 2013: Record ribbon not loading

Recently, we faced a strange issue in CRM 2013, we were using workflow to send notification emails and embed dynamic URL for the record

.Once user clicks the record using the dynamic url in email, it will open the record but form ribbon and sitemap area was not loading:

image

On digging, we found in our case Dynamic URL was embedding extra / in the URL:

image

Hence, as a workaround load following script on the form load which fixed the issue(only pain is record seems to refresh for extra time, when user has opened the record via email link):

function onLoadURLCheck()

{

var url = window.location.href;
if (url.indexOf(‘//main.aspx’) >= 0)
{
url = url.replace(“//main.aspx”,”/main.aspx”);
window.location.href = url;
}

}

This fixed the issue for us:

image 

image

Note: This is unsupported script!

Hope it helps!

{Utility} Process Views for Dynamics CRM 2013

In CRM 2013 there have been various additions to process types, for quicker access directly to individual Type of process :

image

Follow below steps to create Process Views:

Download solution extender:

http://solutionextender.codeplex.com/downloads/get/522781

Import the following xml to your organization.Save the below file as xml and import the file using above tool:

<Settings>
  <UserQuery xmlns:xsi=”
http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
    <RecordId>00000000-0000-0000-0000-000000000000</RecordId>
    <AdvancedGroupBy />
    <ColumnSetXml />
    <ConditionalFormatting />
    <Description />
    <FetchXml>&lt;fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’&gt;&lt;entity name=’workflow’&gt;&lt;attribute name=’workflowid’/&gt;&lt;attribute name=’name’/&gt;&lt;attribute name=’category’/&gt;&lt;attribute name=’primaryentity’/&gt;&lt;attribute name=’statecode’/&gt;&lt;attribute name=’createdon’/&gt;&lt;attribute name=’ownerid’/&gt;&lt;attribute name=’owningbusinessunit’/&gt;&lt;attribute name=’type’/&gt;&lt;order attribute=’name’ descending=’false’/&gt;&lt;filter type=’and’&gt;&lt;condition attribute=’category’ operator=’eq’ value=’3’/&gt;&lt;/filter&gt;&lt;/entity&gt;&lt;/fetch&gt;</FetchXml>
    <LayoutXml>&lt;grid name=’resultset’ object=’4703′ jump=’name’ select=’1′ icon=’1′ preview=’0’&gt;&lt;row name=’result’ id=’workflowid’&gt;&lt;cell name=’name’ width=’300′ /&gt;&lt;cell name=’category’ width=’200′ /&gt;&lt;cell name=’primaryentity’ width=’200′ /&gt;&lt;cell name=’type’ ishidden=’1′ width=’100′ /&gt;&lt;cell name=’statecode’ width=’100′ /&gt;&lt;cell name=’createdon’ width=’100′ /&gt;&lt;cell name=’ownerid’ width=’200′ /&gt;&lt;cell name=’owningbusinessunit’ width=’200′ /&gt;&lt;/row&gt;&lt;/grid&gt;</LayoutXml>
    <Name>Actions</Name>
    <QueryType>0</QueryType>
    <ReturnedTypeCode>workflow</ReturnedTypeCode>
  </UserQuery>
  <UserQuery xmlns:xsi=”
http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
    <RecordId>00000000-0000-0000-0000-000000000000</RecordId>
    <AdvancedGroupBy />
    <ColumnSetXml />
    <ConditionalFormatting />
    <Description />
    <FetchXml>&lt;fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’&gt;&lt;entity name=’workflow’&gt;&lt;attribute name=’workflowid’/&gt;&lt;attribute name=’name’/&gt;&lt;attribute name=’category’/&gt;&lt;attribute name=’primaryentity’/&gt;&lt;attribute name=’statecode’/&gt;&lt;attribute name=’createdon’/&gt;&lt;attribute name=’ownerid’/&gt;&lt;attribute name=’owningbusinessunit’/&gt;&lt;attribute name=’type’/&gt;&lt;order attribute=’name’ descending=’false’/&gt;&lt;filter type=’and’&gt;&lt;condition attribute=’category’ operator=’eq’ value=’0’/&gt;&lt;condition attribute=’mode’ operator=’eq’ value=’0’/&gt;&lt;/filter&gt;&lt;/entity&gt;&lt;/fetch&gt;</FetchXml>
    <LayoutXml>&lt;grid name=’resultset’ object=’4703′ jump=’name’ select=’1′ icon=’1′ preview=’0’&gt;&lt;row name=’result’ id=’workflowid’&gt;&lt;cell name=’name’ width=’300′ /&gt;&lt;cell name=’category’ width=’200′ /&gt;&lt;cell name=’primaryentity’ width=’200′ /&gt;&lt;cell name=’type’ ishidden=’1′ width=’100′ /&gt;&lt;cell name=’statecode’ width=’100′ /&gt;&lt;cell name=’createdon’ width=’100′ /&gt;&lt;cell name=’ownerid’ width=’200′ /&gt;&lt;cell name=’owningbusinessunit’ width=’200′ /&gt;&lt;/row&gt;&lt;/grid&gt;</LayoutXml>
    <Name>Background Workflows</Name>
    <QueryType>0</QueryType>
    <ReturnedTypeCode>workflow</ReturnedTypeCode>
  </UserQuery>
  <UserQuery xmlns:xsi=”
http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
    <RecordId>00000000-0000-0000-0000-000000000000</RecordId>
    <AdvancedGroupBy />
    <ColumnSetXml />
    <ConditionalFormatting />
    <Description />
    <FetchXml>&lt;fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’&gt;&lt;entity name=’workflow’&gt;&lt;attribute name=’workflowid’/&gt;&lt;attribute name=’name’/&gt;&lt;attribute name=’category’/&gt;&lt;attribute name=’primaryentity’/&gt;&lt;attribute name=’statecode’/&gt;&lt;attribute name=’createdon’/&gt;&lt;attribute name=’ownerid’/&gt;&lt;attribute name=’owningbusinessunit’/&gt;&lt;attribute name=’type’/&gt;&lt;order attribute=’name’ descending=’false’/&gt;&lt;filter type=’and’&gt;&lt;condition attribute=’category’ operator=’eq’ value=’4’/&gt;&lt;/filter&gt;&lt;/entity&gt;&lt;/fetch&gt;</FetchXml>
    <LayoutXml>&lt;grid name=’resultset’ object=’4703′ jump=’name’ select=’1′ icon=’1′ preview=’0’&gt;&lt;row name=’result’ id=’workflowid’&gt;&lt;cell name=’name’ width=’300′ /&gt;&lt;cell name=’category’ width=’200′ /&gt;&lt;cell name=’primaryentity’ width=’200′ /&gt;&lt;cell name=’type’ ishidden=’1′ width=’100′ /&gt;&lt;cell name=’statecode’ width=’100′ /&gt;&lt;cell name=’createdon’ width=’100′ /&gt;&lt;cell name=’ownerid’ width=’200′ /&gt;&lt;cell name=’owningbusinessunit’ width=’200′ /&gt;&lt;/row&gt;&lt;/grid&gt;</LayoutXml>
    <Name>Business Process Flows</Name>
    <QueryType>0</QueryType>
    <ReturnedTypeCode>workflow</ReturnedTypeCode>
  </UserQuery>
  <UserQuery xmlns:xsi=”
http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
    <RecordId>00000000-0000-0000-0000-000000000000</RecordId>
    <AdvancedGroupBy />
    <ColumnSetXml />
    <ConditionalFormatting />
    <Description />
    <FetchXml>&lt;fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’&gt;&lt;entity name=’workflow’&gt;&lt;attribute name=’workflowid’/&gt;&lt;attribute name=’name’/&gt;&lt;attribute name=’category’/&gt;&lt;attribute name=’primaryentity’/&gt;&lt;attribute name=’statecode’/&gt;&lt;attribute name=’createdon’/&gt;&lt;attribute name=’ownerid’/&gt;&lt;attribute name=’owningbusinessunit’/&gt;&lt;attribute name=’type’/&gt;&lt;order attribute=’name’ descending=’false’/&gt;&lt;filter type=’and’&gt;&lt;condition attribute=’category’ operator=’eq’ value=’1’/&gt;&lt;/filter&gt;&lt;/entity&gt;&lt;/fetch&gt;</FetchXml>
    <LayoutXml>&lt;grid name=’resultset’ object=’4703′ jump=’name’ select=’1′ icon=’1′ preview=’0’&gt;&lt;row name=’result’ id=’workflowid’&gt;&lt;cell name=’name’ width=’300′ /&gt;&lt;cell name=’category’ width=’200′ /&gt;&lt;cell name=’primaryentity’ width=’200′ /&gt;&lt;cell name=’type’ ishidden=’1′ width=’100′ /&gt;&lt;cell name=’statecode’ width=’100′ /&gt;&lt;cell name=’createdon’ width=’100′ /&gt;&lt;cell name=’ownerid’ width=’200′ /&gt;&lt;cell name=’owningbusinessunit’ width=’200′ /&gt;&lt;/row&gt;&lt;/grid&gt;</LayoutXml>
    <Name>Dialogs</Name>
    <QueryType>0</QueryType>
    <ReturnedTypeCode>workflow</ReturnedTypeCode>
  </UserQuery>
  <UserQuery xmlns:xsi=”
http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
    <RecordId>00000000-0000-0000-0000-000000000000</RecordId>
    <AdvancedGroupBy />
    <ColumnSetXml />
    <ConditionalFormatting />
    <Description />
    <FetchXml>&lt;fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’&gt;&lt;entity name=’workflow’&gt;&lt;attribute name=’workflowid’/&gt;&lt;attribute name=’name’/&gt;&lt;attribute name=’category’/&gt;&lt;attribute name=’primaryentity’/&gt;&lt;attribute name=’statecode’/&gt;&lt;attribute name=’createdon’/&gt;&lt;attribute name=’ownerid’/&gt;&lt;attribute name=’owningbusinessunit’/&gt;&lt;attribute name=’type’/&gt;&lt;order attribute=’name’ descending=’false’/&gt;&lt;filter type=’and’&gt;&lt;condition attribute=’category’ operator=’eq’ value=’0’/&gt;&lt;condition attribute=’mode’ operator=’eq’ value=’1’/&gt;&lt;/filter&gt;&lt;/entity&gt;&lt;/fetch&gt;</FetchXml>
    <LayoutXml>&lt;grid name=’resultset’ object=’4703′ jump=’name’ select=’1′ icon=’1′ preview=’0’&gt;&lt;row name=’result’ id=’workflowid’&gt;&lt;cell name=’name’ width=’300′ /&gt;&lt;cell name=’category’ width=’200′ /&gt;&lt;cell name=’primaryentity’ width=’200′ /&gt;&lt;cell name=’type’ ishidden=’1′ width=’100′ /&gt;&lt;cell name=’statecode’ width=’100′ /&gt;&lt;cell name=’createdon’ width=’100′ /&gt;&lt;cell name=’ownerid’ width=’200′ /&gt;&lt;cell name=’owningbusinessunit’ width=’200′ /&gt;&lt;/row&gt;&lt;/grid&gt;</LayoutXml>
    <Name>Real-time Workflows</Name>
    <QueryType>0</QueryType>
    <ReturnedTypeCode>workflow</ReturnedTypeCode>
  </UserQuery>
  <UserQuery xmlns:xsi=”
http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
    <RecordId>00000000-0000-0000-0000-000000000000</RecordId>
    <AdvancedGroupBy />
    <ColumnSetXml />
    <ConditionalFormatting />
    <Description />
    <FetchXml>&lt;fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’&gt;&lt;entity name=’workflow’&gt;&lt;attribute name=’workflowid’/&gt;&lt;attribute name=’name’/&gt;&lt;attribute name=’category’/&gt;&lt;attribute name=’primaryentity’/&gt;&lt;attribute name=’statecode’/&gt;&lt;attribute name=’createdon’/&gt;&lt;attribute name=’ownerid’/&gt;&lt;attribute name=’owningbusinessunit’/&gt;&lt;attribute name=’type’/&gt;&lt;order attribute=’name’ descending=’false’/&gt;&lt;filter type=’and’&gt;&lt;condition attribute=’category’ operator=’eq’ value=’0’/&gt;&lt;/filter&gt;&lt;/entity&gt;&lt;/fetch&gt;</FetchXml>
    <LayoutXml>&lt;grid name=’resultset’ object=’4703′ jump=’name’ select=’1′ icon=’1′ preview=’0’&gt;&lt;row name=’result’ id=’workflowid’&gt;&lt;cell name=’name’ width=’300′ /&gt;&lt;cell name=’category’ width=’200′ /&gt;&lt;cell name=’primaryentity’ width=’200′ /&gt;&lt;cell name=’type’ ishidden=’1′ width=’100′ /&gt;&lt;cell name=’statecode’ width=’100′ /&gt;&lt;cell name=’createdon’ width=’100′ /&gt;&lt;cell name=’ownerid’ width=’200′ /&gt;&lt;cell name=’owningbusinessunit’ width=’200′ /&gt;&lt;/row&gt;&lt;/grid&gt;</LayoutXml>
    <Name>Workflows</Name>
    <QueryType>0</QueryType>
    <ReturnedTypeCode>workflow</ReturnedTypeCode>
  </UserQuery>
</Settings>

Hope it helps!

{Guide} Step by Step: Install Email router for Dynamics CRM 2013

Recently did a fresh CRM 2013 deployment and documented Email router installations steps for reference:

· Download Email router for CRM 2013 from following link:

http://www.microsoft.com/en-us/download/confirmation.aspx?id=40342

· Click Installer and following extractor will be launched:

clip_image001

· Pick a folder to extract and then start extracting, next screen will be as below:

clip_image002

It is recommended that selected option for getting updated is kept. Click Next.

· Setup will check and let you know if update is needed:

clip_image003

Click Next.

· Accept the License agreement checkbox and click I Accept:

clip_image004

· Setup will point for missing components, if any, Please Install them by clicking Install button:

clip_image005

· Once completed with installation, Click next on screen as below:

clip_image006

· Select components to install(Click checkbox for installation):

clip_image007

Click Next.

· Pick the installation drive and click Next:

clip_image008

· At this step, You might encounter this error:

clip_image009

When you try to install Microsoft Dynamics CRM E-mail Router, you receive the following error message:

The Microsoft Exchange MAPI subsystem is not installed on this system.

Refer to the KB article link to resolve this issue: http://support.microsoft.com/kb/951401

· Once installed with the required dll, continue as below:

clip_image010

Click Next.

· Click on Install:

clip_image011

· Email router setup for Dynamics CRM 2013 is complete. Press Finish:

clip_image012

Hope it helps!

{Error} Custom Filter Error There was an error processing your request

Scenario:

· Click on the filter icon to enable filtering on every column

· Click on any column filter

· Click on Custom Filter

· Select Equals as the option

Issue:

– “There was an error processing your request” error is displayed

Resolution:

In our case we found & needs to be removed from option set text as per below community link: http://community.dynamics.com/crm/f/117/t/120944.aspx

Read Option set Text/Value at one go CRM 2013

Often we have requirement to read option set Text/Value quickly, I wrote a script to quickly read all option sets on a form

Go to Google chrome console(Press F12 in Chrome), select the option Console as per screen, Note that contentIframe0 is selected  :

image

and run following script on your form :

var attributes = Xrm.Page.data.entity.attributes.get();

var optionSetAttributes = ”;
var optionSetValues = ”;
Xrm.Page.ui.controls.forEach(function (control, index) {
    if (control.getControlType() == ‘optionset’) {
        optionSetValues = ”;
        var controlName = “#” + control.getName() + “_i”;
        optionSetValues += control.getName() + ” option set values below: \n\n”;
        $(controlName).find(‘option’).first().nextAll().each
        (function () {
            optionSetValues += ‘<div>’ + ‘Value: ‘ + $(this).attr(‘value’) + ‘,Title: ‘ + $(this).attr(‘title’) + ‘</div>’;
        }
        );
    }
    optionSetAttributes += ‘<div>’ + optionSetValues + ‘</div>’;
});

var htmlString = ‘<div style= “overflow:always”>’ + optionSetAttributes + ‘</div>’;
$(“#processControlCollapsibleArea”).after(htmlString);

var w = window.open(“Surprise”, “#”);
var d = w.document.open();
d.write(htmlString);
d.close();

You will get following new page:

image

Just do Ctrl+ C and you are done!

Hope it helps!

Change color for text fields : Dynamics CRM 2013

Sometimes we get requirement to change the forecolor for some fields in Dynamics CRM 2013 in order to highlight them in different color. So we implemented following script:

You can add the scripts on-load or based on some condition.

For changing color during field is non-selected:

//Setting red color

$(‘#fieldname’).find(‘div[class=”ms-crm-Inline-Value”]’).css(‘color’,color);

Now Field looks like this:

image

In order to change color during field is typed:

//Setting color blue during typing of field

$(‘#fieldname_i’).css(‘color’, color);

UI will look like below now:

image

Note: This is unsupported script and may break in future if Microsoft changes something.

Hope it helps!


Check this out

Trying to Learn Dynamics CRM: Download!

Learn Dynamics CRM App on Google Play store