Who needs a free customizable team calendar for Dynamics CRM 2013? Maybe you do.

How many times have you heard “I need to display my team’s data in a calendar view” while customizing a Dynamics CRM system? Perhaps more than once, and unless you used one of the paid components available on the market, you were out of luck.

At BusiPlanIT labs, we have come up with a solution that leverages one popular open source JQuery library (FullCalendar) and some OData calls, and embedded them in a solution that allows us to place a calendar anywhere we want in any Dynamics CRM 2013 application.

The components of this solution are:

  • JQuery library (jquery.com)
  • FullCalendar library and styling file (http://fullcalendar.io)
  • HTML page
  • JavaScript that contains OData calls to fetch your data
  • Sample dashboard

The HTML web resource can be used with any entity (OOTB or custom) and the data displayed is sorted by a date field passed in the custom parameters. In addition, you can pass an OData filter and a team name for further filtering. Your data will be color coded, green for active and red for inactive records. Each record displayed in the calendar includes a live link, so that you can navigate directly to the corresponding detail form.

The end result will look like this:

TeamCalendar

The following image shows the configuration screen for the HTML web resource:

TeamCalendar_Setup

Note that you will need to pass a comma separated list of parameters in the format:

Parameter1,Parameter2,Parameter3,Parametr4,Parameter5

  1. Parameter1 (Required) – Entity schema name (use the exact same casing as found in the entities list)
  2. Parameter2 (Required) – Date field schema name (use the exact same casing as found in the attributes list) to sort data in calendar.
  3. Parameter3 (Required) – String field schema name (use the exact same casing as found in the attributes list) to display in the calendar.
  4. Parameter4 (Optional) – OData filter for additional filtering (example “&$filter=Community/Value eq 1” for social channel Facebook).
  5. Parametr 5 (Optional) – Team name to filter by its members.

The parameters in the provided  example “ActivityPointer,ModifiedOn,Subject,,test,” will fetch all “activities” whose members belong to the team “test“, the field to be displayed in the calendar will be the “Subject” and the cells will displayed on the last date they were modified. It’s up you to decide which date field suits your needs best; for example if you wanted to show activities by due date, then the syntax would be “ActivityPointer,ScheduledEnd,Subject,,test,“, or if you wanted to sort them by start date then you would use “ActivityPointer,ScheduledStart,Subject,,test,“. The calendar can change display modes from daily, weekly to monthly.

This free component has some limitations that will be addressed in the paid version:

  • No drag and drop
  • Only captures one date, so no data ranges are shown
  • No edits are available from within the calendar
  • Teams of type “Access” are not supported

If you want to get a copy of the solution, just send us a request at: http://busiplanit.com/contactus.aspx

DISCLAIMER
THIS TOOL IS PROVIDED BY BUSIPLANIT INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BUSIPLANIT INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

OData Syntax and JSON

The last html web resource I wrote seemed to be another routine coding activity.  This was a simple graphical indicator to display a light based on a value in a CRM form, and a simple OData query to fetch a single value.

This time I decided to use the following syntax:

http://<servername>/xrmservices/2011/OrganizationData.svc/<Entity>
Set(guid'<guid_value>’)?$select=<list_of_fields>

The Odata query worked as expected but the web resource was not.  Nothing was displayed and no error was generated.

After several hours of research and debugging, I found out that the JSON string that was generated had the following format:

json1

This was a little bit different from what my standard parsing routine expected.  Basically, the idea was to traverse an array called “results” using this construct:

var retrievedData = new XMLHttpRequest();

retrievedData.open(“GET”, url, false);

retrievedData.setRequestHeader(“Accept”, “application/json”);

retrievedData.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);

retrievedData.onreadystatechange = function () { retrieveReqCallBack(this, destination); };

retrievedData.send();

var fetchedData = JSON.parse(retrievedData.responseText).d;

for (var i = 0; i < fetchedData.results.length; i++) {

. . . DO SOMETHING HERE

}

Looking at old web resources that fetched multiple records, the JSON string returned was like this:

json2

So, I had a smoking gun and then the fix was relatively easy. I just needed to access the attributes of the returned (single-record) dataset directly:

var dateStart = fetchedData.myAttribute;

. . . DO SOMETHING HERE

But I wasn’t happy just finding a fix to the problem.  I needed to find the root of the problem, why was the JSON string different?

The answer was in the OData syntax used.  In previous web resources I had used “filter”:

http://<servername>/xrmservices/2011/OrganizationData.svc/<Entity>Set?$filter=<key_name>/Id eq guid'{ <guid_value> }’&$select=<list_of_fields>

This syntax will fetch the same single record but it will use the equivalent to RetrieveMultiple in the SDK, which automatically wraps the fetched results in an array called “results”.

So, keep that in mind the next time you use OData, that the syntax you choose may have an impact on how the returned dataset needs to be parsed.

New Discovery URI for O365 CRM Online

The other day I was going through the process of writing a plug-in for a Microsoft Dynamics CRM Online client. When it came to connecting the Plugin Registration Tool to their online tenant it reminded me to share this piece of wisdom so that you won’t go on a wild goose chase or second guess your CRM knowledge.

Then trying to connect you must give some basic info so that the tool can authenticate to your Online tenant. Something that Microsoft hasn’t communicated very clearly to CRM Online customers is that the authentication method has changed between January and July of 2013 depending on when your tenant was scheduled to convert over to use the O365 authentication from the old Live ID method.

Now, back to the connection info. The following screen shows the connection info for the Plugin Registration Tool (also used on the Developer Toolkit for connecting to CRM Explorer; and likely other common tools). For the discovery service, you will need to change your URI from the old way when it was Live ID authentication:

OLD WAY:

old-live-id-auth-crm
If you try to perform the above, you will surely get the famous authentication failed message.  Just truncate the discovery URI as depicted and you’ll surely connect.

Note the my example below uses the un-federated domain that O365 assigns your AD when you sign up; thus the “username@org_name.onmicrosoft.com” versus if your domain is federated it would look something like “username@domain.com” for the User Name.

The following picture shows the correct discovery URI to authenticate using O365 authentication.

CORRECT WAY:

new-o365 auth-crm

Hopefully this helps save you time.  Until next time, happy CRMing.

Yes, we drink our own KoolAid

Yes, we drink our own KoolAid

We just finished our first draft of our website (www.busiplanit.com), and we faced the dilemma of keeping it static or making it somewhat dynamic. So we decided to lead by example and connected our site with our own instance of Dynamics CRM Online.

Technically, it wasn’t as difficult as we thought it was going to be, and now we have a working example of how easy it is to use Dynamics CRM to keep track of your contacts and leads, even outside of the native Dynamics CRM interface. Granted, we didn’t build a full fledged portal with user authentication or Dynamics as a content management system (like the ADX Studio Portal), but still we are able to capture leads and manage the inquiries posted by our visitors, and by the way, we made it using the ‘Responsive UI’ design pattern so you can access it from any device.

Here are a few highlights of what you’ll need for a seamless integration of you portal with Dynamics CRM:

  • Find a host that offers at least .Net framework 4.0 and allows for full trust level.
  • Add the following tags in your web.config:
  1. <trust level=”Full” /> in system.web
  2. <add name=”Your Connection Name” connectionString=”Url=Your CRM Online Url”; Username=Your user name; Password=Your password;/>  in connectionStrings
  3. <section name=”microsoft.xrm.client” type=”Microsoft.Xrm.Client.Configuration.CrmSection, Microsoft.Xrm.Client” /> in configSections
  4. <add name=”Xrm” type=”Xrm.XrmServiceContext, busiplanit_1″ /> under contexts, microsoft.xrm.client
  • Even if you are using .Net 4.5, make sure you add microsoft.identitymodel.dll in your project (bin)
  • For you own protection, we recommend you add some anti-bot routine either a captcha component (lots of them in the market) or you may develop your own.
  • Finally, we developed a routine that loads static data from Dynamics CRM asynchronously, but that may deserve its own blog entry.

Well, we hope to hear from you and your questions, and are eager to apply these techniques to help you solve your information needs.