The XRM Toolbox for Dynamics CRM is a collection of utilities for Dynamics CRM developers and administrators, written by fellow MVP Tanguy TOUZARD.

The Toolbox received an update today that includes two new tools:

 

User Settings Utility

Update user settings in bulk.

image

Metadata Browser

Browse metadata without installing solution in your organization.

image

 

Other Tools Updates

  • ViewLayoutReplicator : Fixed source view display layout
  • ViewLayoutReplicator : Fixed tool layout
  • ViewLayoutReplicator: Fixed removal of criteria in target view link-entity nodes
  • ImportNN : Fixed import of NN relationships between the same entity
  • EasyTranslator: Added SiteMap custom labels translation
  • FormAttributeManager : Adding sorting and selection capabilities
  • SynchronousEventOrderEditor: Fixed missing close button

 

More information may be found in this post.

I picked up a really cool tip from Rui Marinho and @DhirendraKumar in answer to a forum post last month.

Suppose you want to add a view with a semi-transparent background, like this:

image

 

I personally really like this look at you can see it in many different applications.

Here is all it takes:

var slTitleBlock = new StackLayout
{
    Padding = new Thickness(6, 5, 6, 5),
    BackgroundColor = new Color(0, 0, 0, 0.5), 
    HorizontalOptions = LayoutOptions.FillAndExpand,
    VerticalOptions = LayoutOptions.End,
    Spacing = 0,
    Children = { lblTitle, lblSubtitle }
};

 

Oone of the Color constructors allows you to set the Alpha Channel value, which controls the opacity of the color.  By setting it to 0.5, you get the semi-transparent color.

,

Like most Xamarin developers I have a Mac setting on my desk.  Unfortunately I do not find myself to be as productive on a Mac keyboard as I do on the Windows Keyboard.

When Xamarin’s Visual Studio integration was released, and it became stable enough to develop with Visual Studio on my Windows workstation instead of Xamarin Studio on the Mac, I could not have been happier.

The problem still remained that I needed to access the Mac for at least some testing on the iOS simulator.  At first I was just turning my chair and using the Macbook directly.

Then I remembered that GoToMyPC has a Mac client, and I happen to have a two-host license.  So, I installed GotoMyPC on the Mac, and have really enjoyed how much code I can write, and test, using this setup.

I am comfortable with my development tools (Visual Studio, Resharper, etc)., and when I need test my iOS apps, I just open a GotoMyPC session to my Mac and run the simulator.

When I work from home I actually use GotoMyPC to connect to my desktop at the office and when doing iOS development, just start another session to my Mac, which is also at the office.

I mention this now because I don’t think a lot of people think about a remote desktop tool being a productivity aid for developers – and it may not be for everyone – but it sure was for me.

Fellow MVP Jason Lattimer (@JLattimer) has released a really cool tool for us Dynamics CRM JavaScript developers: CRM Rest Builder

This is a solution you install inside of Dynamics CRM with the main interface looking like this:

 

Features

We can utilize the following SDK methods:

  • Retrieve
  • RetrieveMultiple
  • Create
  • Update
  • Delete
  • Associate
  • Disassociate

 

Generated JavaScript

CRM Rest Builder will generate code that utilizes the following JavaScript libraries to actually execute the methods:

  • XrmSvcToolkit,
  • jQuery
  • SDK.REST
  • SDK.JQUERY
  • XMLHTTP

It can also generate Asynchronous or Synchronous method calls, depending on your requirements.

 

Data Selection and Filters

You can select a variety of data points to utilize including:

  • The Entity
  • Set the maximum number of values to be returned
  • Fields
  • One to Many relationships
  • Many to One relationships
  • Many to Many relationships

You can specify the data be filtered much as you would with the Dynamics CRM Advanced Find feature including:

  • Field-level filters
  • Sort orders

 

Output

The generated code is displayed in a window like this:

Conclusion

I actually quite mad at Jason right now.  He would have saved me a couple of hours banging my head against the wall last week.  Actually, I can’t blame Jason for me not paying attention. Smile

Anyway, this is a great tool to add to your development toolbox and I for one, am excited to see it released.

Time is a funny thing.  Invented by scientists to keep everything from happening at once, and the thing that drives our modern society.

When working with Dynamics CRM it is very important that your workstation – desktop, laptop, Surface, tablet, phone, etc. – have the correct and current time.

 

The Problem

Consider this rather interesting error message received while attempting to connect to Dynamics CRM Online:

image

While not easy for a layman to read, the error simply states that you cannot connect to Dynamics CRM because the clock on your computer is more than 5 minutes different than the Dynamics CRM server you are attempting to connect to.

The real issue is this error can surface itself in a variety of ways with most of them being very hard to diagnose.  See the References section below for more information.

 

The Solution

This is a very easy thing to fix – just reset the computer’s clock.

This article mentions three methods for correcting the computer’s clock, with option 2, synchronization with an Internet time server being my favorite, if you are running a desktop that is connected to the Internet full-time.

 

References

The following information is based on pre-release software and documentation and is subject to change an inaccuracies. 

The Xamarin.Forms team has released a technical preview of Xamarin.Forms 1.3.0.  As is now the standard, this is a Nuget package which is attached to the announcement but you will need to download and install it manually.

In this article we will cover:

  1. Installation of the 1.3.0 package
  2. Explore the changes to the base Xamarin Application configuration

The sample code is available here:

https://github.com/MitchMilam/XamarinForms_1_3_0

 

Xamarin.Forms 1.3.0 Technical Preview Installation

After you have downloaded and unzipped the Nuget package, perform the following steps to install the Nuget package.

Add a Package Source Location

1. Select Tools, Nuget Package Manager, Package Manager Settings:

image

2. Select Package Sources:

image

3. Then Click the Plus sign over the Available package sources list.

4. Edit the Name and Source folder as required, then click the Update button.

5. Click OK to save your changes.

 

Create a new Xamarin Forms Project using 1.3.0

For this discussion, we’re going to start from scratch and create a new Xamarin.Forms project.

After the solution and projects have been created, we need to update our Xamarin.Forms package:

1. Select Tools, Nuget Package Manager, Manage Nuget Packages for Solution.

2. Expand Updates.

3. Select the Package Source you created in the previous steps:

image

4. Select Xamarin.Forms v1.3.0.pre0 (the only one list).

5. Click the Update button.

Assuming everything went as planned, you should now be running Xamarin.Forms 1.3.0.

 

Introducing the XamarinApplication Class

There is a new class which will be the basis for our Xamarin.Forms applications from this point forward.

Here is a brief overview of what is included:

  • Supports easy changing of root page
  • Persistent data store via Properties dictionary
  • Sleep/Resume/Start events
  • Application level resource dictionary

Let’s review the basic structure changes to the Shared and Platform-specific code.

 

Shared-Code Application Class

Here is how our App code looks:

    public class MyApp : Application
    {
        public MyApp()
        {
            MainPage = new ContentPage
            {
                Content = new Label
                {
                    Text = "Hello, Forms !",
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                },
            };
        }

        protected override void OnResume()
        {
            Console.WriteLine("OnResume");
            base.OnResume();
        }

        protected override void OnSleep()
        {
            Console.WriteLine("OnSleep");
            base.OnSleep();
        }

        protected override void OnStart()
        {
            Console.WriteLine("OnStart");
            base.OnStart();
        }
    }

As you can see, we now inherit from Application and there are three new methods to help us handle various Application-wide events.

Also notice that our GetMainPage method has been replaced with a MainPage property.

 

iOS AppDelegate

The AppDelegate class in the iOS application now looks like this:

    public partial class AppDelegate : FormsApplicationDelegate
    {
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();

            LoadApplication(new MyApp());

            return base.FinishedLaunching(app, options);
        }
    }

Notice we are inheriting from FormsApplicationDelegate and the LoadApplication method is now handling all of the user interface initialization and the passing of the application’s main screen back to the phone.

 

Android MainActivity

Here is how the MainActivity looks:

    public class MainActivity : FormsApplicationActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Forms.Init(this, bundle);

            LoadApplication(new MyApp());
        }
    }

Notice we are inheriting from FormsApplicationActivity and the LoadApplication method call is doing the work of setting up our interface.

 

Windows Phone MainPage

Here is the Windows Phone implementation”":

    public partial class MainPage : FormsApplicationPage
    {
        public MainPage()
        {
            InitializeComponent();

            Forms.Init();

            LoadApplication(new MyApp());
        }
    }

This setup is the same as the other two but in this case, the page is inherited from FormsApplicationPage.

Don’t forget to modify your XAML to reflect the base class:

<winPhone:FormsApplicationPage
</winPhone:FormsApplicationPage>

 

 

Next Steps

Again, this is all preliminary information.  I’ll try and dig deeper as more information becomes available.

,

Nuget is the direction that may developers, including Xamarin, are moving as far as pushing components into solutions written using Visual Studio or Xamarin Studio.

I have a love/hate relationship with Nuget.  When it works, it works great.  When it doesn’t work, it is worse than the DLL Hell we used to endure way back when.

The Xamarin.Forms team ships updates to their component on a fairly regular basis and I always dread attempting to apply an update because I use Resharper, which seems to cause all types of issues when installing certain packages.

I am totally unsure if it is Resharper, Visual Studio, Nuget, Xamarin, or Xamarin.Forms which have the issues, but you can totally break your solution and have to deinstall and reinstall all of your components from scratch.  At least that has been my experience, on my main development machine using Visual Studio 2013.

 

A Solution

@ChaseFlorell gave a really great answer to a question on the Xamarin.Forms forum yesterday regarding the proper update procedure if you have Resharper installed. He gave me permission to document it here.

 

Step 1: Disable Resharper

Run this command in the Visual Studio Command Window:

Resharper_Suspend

This can also be accomplished by selecting:

Tools, Options, ReSharper, Suspend Now

 

Step 2: Open the Nuget Package Manager Console.

Tools, Nuget Package Manager, Package Manager Console.

Step 3: Install Xamarin.Forms updates

Run the command:

Get-Project -all | Install-Package Xamarin.Forms

Note: This process may require you to reboot Visual Studio. If so, then save your solution when prompted so that the changes Nuget made are recorded.

 

Step 4: Verification

I always like to verify that the process worked correctly, which you can do by opening the Nuget Package Manager:

Tools, Nuget Package Manager, Manage Nuget Packages for Solution

Click on the Installed packages node and review the version number of Xamarin.Forms to make sure it updated properly.

 

Step 5: Re-enable Resharper

Back in the Command window, run this command:

Resharper_Resume

This can also be accomplished by selecting:

Tools, Options, ReSharper, Resume

 

Final Thoughts

While this process looks, and should be, fairly simple, it may not be.

I was updating one of my projects as I was writing this article and even after restarting Visual Studio when told to do so, I still get the message that I need to restart Visual Studio to complete the reinstallation process – no matter how many times I restarted.

So, in summary, the above technique should work for most people, but when it doesn’t then you need to be prepared to complete the steps manually.

And keep in mind that I have had to actually remove all of the Xamarin.Forms packages from my solution and reinstall them from scratch to get them to reinstall properly.

That may be just me and my machine so your experience may vary.

I was adding some “fancy” to a Contact form today that I thought I would share with you:

 

The Concept

On the Contact form, I have added the two sets of addresses that are built into Contact and am calling them Primary Address and Secondary Address.  I thought it would enhance the user experience to change the label when a user specifies the actual type of address.

The result is something like this:

image

 

The Implementation

Follow these steps to implement this solution:

Step 1

1. Create two sections on the form to hold the fields, one for Address1 fields, the second for Address2 fields. Each should be configured like this:

image

2. Add the address fields to the form, to their respective sections.

 

Step 2

Add the JavaScript above to the web resource for Contact.  If you already have an onLoad method, just add those two lines of code to your method.

 

Step 2:

Add events to each of the Address Type fields:

SNAGHTMLf2ab9f7

Notice that the Pass execution context as first parameter is checked. This is vitally important and the process will not work without it..

Save and publish the form.

 

Step 3:

Testing using the following protocol:

1. Open a new Contact.

2. Change the value of the Primary Address type.

3. You should see the Primary Address section label change.

4. Repeat steps 1-3 for the Secondary address.

5. Save and close the record.

6. Reopen the record.

7. Verify that the section headers change.

 

Code Review

Let’s take a deeper dive into the code.  I could have hard-coded the section values into our JavaScript but I thought that it would be better to make a fairly generic version of our code.

Take a look at the beginning of function.

function addressType_onChange(executionContextObj) {
    var field = executionContextObj.getEventSource();

This code gets a handle to the attribute which fired the change event.

Since we are working with an OptionSet, we need to get the label for the currently selected value:

var addressType = field.getText();

Next, a check to make sure we actually have a value:

if (addressType != null && addressType != "") {

And finally, the tricky part:

field.controls.get(0).getParent().setLabel(addressType + " Address")

 

field is a handle to the attribute, but we need to get to the parent Section where the attribute resides. Unfortunately, the getParent() method is only associate with a form control. 

.controls.get ( 0 ).getParent() will get the parent of the first control associated with the attribute, with the parent being the Section itself

Note: This is making an assumption that the field is not on the form more than once.

Finally, setLabel() is actually going to reset the label for the Section using the value from the Address Type OptionSet and the word Address.

 

Conclusion

You can use the exact same technique with other field types, but you will need to modify the .getText method to .getValue and change the validity check statement to match the data type being retrieved.

Other than that, this is a pretty simple piece of code.

Hi Everyone,

I have an update to Transformer!, my JavaScript conversion utility for Dynamics CRM.

 

You may download the trial version here:

http://www.crmaccelerators.net/products/transformer/crm-migration-assistant-demo-request/

 

Updated documentation may be found here:

http://www.crmaccelerators.net/downloads/TransformerDocumentation

 

A full sample conversion may be downloaded here:

http://www.crmaccelerators.net/downloads/sampleconversion

 

And just the conversion report from the sample conversion may be downloaded here:

http://www.crmaccelerators.net/downloads/sampleconversionreport

Release Notes:

This release includes the following new functionality and conversions:

 

CRM 4.0 Web Service Usage Report

A new report has been added to the Conversion Report workbook that summarizes any calls made to the CRM 4.0 web service:

image

This is very helpful in determining how may web service calls that you have, that will need to be upgraded.

 

jQuery

I attempt to determine if a JavaScript file is actually the jQuery library and if so, the conversion is skipped.

 

Third–Party Product JavaScript Libraries

A attempt is made to ignore JavaScript libraries associated with third–party products, assuming you are converting from CRM directly or from a CRM 4.0 customization export file,

At this point, Click Dimensions and ADX Studio (portal) scripts are ignored.  If you have other products that you have installed, then please let me know their customization prefix, and I’ll add it to the list.

 

Hide/Show Sections

There are several different methods to hide and show sections.  I’ve improved the conversion to handle two new cases I discovered:

pc[h].parentElement.parentElement.style.display = "none";

converts to

pc[h].getParent().setVisible(false);

 

crmForm.all.new_onsiterepresentativeid_c.parentElement.parentElement.style.display = ";

converts to

Xrm.Page.getControl("new_designedtochangecompetence").getParent().setVisible(true);

 

Improved Partial Field Name Support

I have improved the conversion process concerning partial field names; those attributes that end with “_c” and “_d.”  They are more effectively converted which can eliminate a large number of conversion reports.

 

 

Remember the goal of the product is to convert as much of your code from the Dynamics CRM 4.0 object model to the Dynamics CRM 2011/2013 object model as is practical. While Transformer! will convert huge percentage of your code, there will still be much work that must be performed manually.

If you notice anything that does not get converted and you feel that it should have been, then please send me the code so I can perform some analysis.

 

Thanks, Mitch

We ran into a fascinating issue when creating Routing Rule recently.

Here is the rule:

image

This is fairly straightforward, but for some reason, we had an issue where the rule was not firing as we expected.

I turns out that behinds the scenes, CRM actually creates a workflow to handle the magic required to route the email.

Normally, you never really see these workflows run because they have the flag set to delete the history if the workflow was successful

But unfortunately, in our case, something was not configured correctly in this workflow and it was failing:

image

We modified the rule slightly and everything seemed to work fine after that. (I wasn’t the one doing the modification so I an not exactly sure what was changed.

Anyway, the moral of the story is that if you ever see strange workflows, that you did not create, failing, see if they are Routing Rules.

Sign up for our new KnowledgeBits service and get news, tips and tricks and more, delivered straight to your inbox.