Posted on 18. October 2013

How to fix CRM2013 Application Bar hidden by Silverlight Web Resource

If you have any Silverlight Web Resources in your site map that are hosted by an HTML Web Resource, you may find that when you upgrade to CRM2013 and use the pull down Application Bar the Silverlight page is rendered on top of the navigation buttons so that they are obscured and hidden from the user.

It might look something like the following:-

To fix this you need to adjust the Windowless property in the Silverlight object:

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
    <param name="Windowless" value="true" />

Other than this I've not had any issues with Silverlight in CRM2013 but there is now a nice phrase in the SDK that states:

"Microsoft Silverlight web resources remain supported in Microsoft Dynamics CRM 2013 and Microsoft Dynamics CRM Online for backwards compatibility. For components that will be able to be presented on all clients, we recommend using HTML web resources with HTML5 instead of Silverlight."

If you need to convert your Silverlight Web Resources to HTML 5 and JavaScript, you could check out www.SparkleXRM.com.

@ScottDurow

Posted on 12. January 2013

getServerUrl is Deprecated. Use getClientUrl instead.

Although at the time of writing UR12 is not yet released - I was checking though the changes in the latest SDK documentation.

In addition to the Ribbon Workbench being listed (yay!) I noticed the following statement about the getServerUrl function

"Deprecated. Use getClientUrl instead. This method is deprecated as of Microsoft Dynamics CRM 2011 Update Rollup 12 and the Microsoft Dynamics CRM December 2012 Service Update."

 

Out with the old

 

Using getServerUrl on it's own always had the potential to cause 'Access Denied' messages if the browser domain Url was different to the server Url stored in the CRM database. This was to do with cross domain access restrictions in IE. A work around was to use a method similar to Daniel Cai gives in his post on the subject - http://danielcai.blogspot.co.uk/2012/02/get-right-server-url-in-your-crm-client.html

In with the new

The SDK described the new getClientUrl as:

"Returns the base URL that was used to access the application."

The function nolonger blindly return the server Url in the database - but looks at the url that was used to access CRM so that cross domain access issues will be a thing of the past!

Read more in the SDK:
http://msdn.microsoft.com/en-us/library/d7d0b052-abca-4f81-9b86-0b9dc5e62a66#BKMK_getClientUrl

@ScottDurow

 

Posted on 18. January 2012

iPad killed the Silverlight star?

After the initial Statement of Direction in May and then the interview with Brad Wilson the then general manager of Dynamics CRM, there has been quite some excitement about cross-browser support for Dynamics CRM 2011. The timescale given was "the first half of 2012" being release with UR8. The thought of access to Dynamics CRM from an iPad is quite an attractive prospect I have to admit - and I'm really excited to see how Microsoft are going to structure the CRM user interface when they deliver it through cross browser HTML5.

  • Are we going to get a single cross browser interface, or will there still be a IE specific one with richer functionality?
  • Will the cross browser support be more like the mobile client - with it's own form design - Will IE still be the preferred browser?
  • You will still need IE to use the Outlook Client so will the cross browser support be more of a 'selling point' than something that actually makes a significant difference to business users?

 

Cross browser HTML5 will mean replacing the IE specific .htc 'behaviours' which is quite a considerable piece of work - but a subject closer to my heart is the future of Silverlight in CRM2011. Silverlight is supported on most modern browsers (http://www.microsoft.com/getsilverlight/get-started/install/default.aspx#) but not on iPads. Could this mean an end to Silverlight WebResources just so that we can get iPad support?

Only time will tell, but it might make it harder to choose the developer productivity and user experience gains that come with Silverlight. The iPad is not a desktop replacement. There are limitations with SalesForce.com on the iPad (http://www.crmverse.com/using-salesforce-com-on-ipad/). Unless a client has decided to use iPads as a primary user interface device, I am still recomending developing Silverlight WebResources but structuring them in a way that will make it easier to port them to an HTML5 user interface when the developer tooling support is improved.

Maybe with Windows 8 Tablets the problem will go away...then again...maybe not!

References:

Posted on 1. December 2011

The future of Silverlight for Dynamics CRM

Recently there has been much talk and rumours of Microsoft discontinuing Silverlight keeping in the tradition of speculating over the Flash vs. Silverlight vs. HTML 5 battle. The thing is; it is an imaginary struggle. It results from our deep seated need to keep things simple and 'black and white'. Sure it's fun to indulge in a bit of 'this house believes' style debating where you have to vote for or against; but I'm not doing that here.

Microsoft has been fairly clear in their direction of Silverlight over the last year; Silverlight is aimed primarily at 'Line of Business Applications' and 'Premium Media Experiences'. Perhaps one reason for there being so much speculation and confusion is down to the complex make-up of Silverlight. Unlike Macromedia's Flash it's not an all-or-nothing technology but rather a combination of many pivotal technologies such as XAML, the .NET Framework and the Command Language Runtime.

  • Rumour 1: There will be no Silverlight 6 – Does that matter? The CLR, .NET Framework and XAML are here to stay for a very long time. It could be that Silverlight will be 'merged' into Microsoft's new WinRT platform emerging from the Metro Design Language and Windows Phone 7 (WP7). I think I might start referring to Silverlight as 'XAML User Interface' until the future is cleared up.
  • Rumour 2: Support for browsers other than Internet Explorer will be dropped from Silverlight 5 – With Silverlight 5 RTW scheduled for the end of 2011, the beta does provide support for browsers other than IE. But from a Dynamics CRM perspective today, even if support for other browsers was dropped it wouldn't matter. After all, the Dynamics CRM connector for Microsoft Outlook doesn't run on other Operating Systems and the web client only supports Internet Explorer. There have been reports of future versions of Dynamics CRM running on other browsers in the 12+ month time frame. A re-write of this kind would be a huge and exciting investment from Microsoft. It will be interesting to see what other user interface enhancements will be made during the process; we might see full HTML 5 developer productivity tools for ISV client extensions. If this happens, then the story for XAML based client add-ins is somewhat diminished, but it doesn't go away, especially if you are targeting clients that you know will be running on a Microsoft Windows platform.
  • Rumour 3: Microsoft will stop producing hot-fixes and service packs for Silverlight - Microsoft are staying silent on the future of Silverlight at the moment, but simply taking the status-quo, we can expect mainstream support for at least 2 years after release date (taking us into 2014 for Silverlight 5), with extend support producing high priority security vulnerability fixes well beyond that. Microsoft has invested hard in dispelling their now out-of-date reputation of not taking security seriously, and they are not about to jeopardise that now. As far as the 'Premium Media Experiences', with truly mass-market companies such as Netflix and LoveFilm investing heavily in Silverlight, Microsoft will be forced to produce a clear migration path to what-ever the V.Next is going to be.

So back to reality; the huge productivity gains to be found from using Silverlight today as your user interface for Dynamics CRM 2011 cannot be ignored until HTML5 XRM developer tool support catches up. I challenge anyone to write a complex piece of user interface code in HTML 5 for Dynamics CRM 2011 in less time than it would take me in Silverlight!

So in summary, the reasons today to use Silverlight compared to ASPX pages are:

  • Silverlight can be seamlessly deployed as part of a CRM 2011 solution.
  • Authentication and Authorisation is seamless with Silverlight, where as ASPX pages need to be deployed as a separate web applicaiton using federated Claims Based security when integrating with CRM Online/IFD.
  • If you have Silverlight skills, it gives a much richer user interface in considerably less development time.
If the developer experience for HTML5 applications catch up with Silverlight, these points could easily apply as well.

Here is a little taster of a Dynamics CRM 2011 Ribbon Designer tool that will be released early next year – you've guessed it – written in Silverlight 5.

 

  •  

    Provided we write our apps with good separation of concerns using the MVVM/MVC paradigm, whatever the future holds, we'll be ready.

    Posted on 28. April 2011

    Early bound Entity Types in Silverlight

    One of the drawbacks of using Silverlight clients for CRM2011, is that there is no built in support for early bound entity types since you cannot use the Microsoft SDK assemblies. Really, there isn't anything that special going on with early bound support in the SDK assemblies – a behaviour is added to the WCF client that intercepts the entities after serialization and converts them to the early bound types.

    Ironically, one of the things about Silverlight is that it needs early bound properties for binding purposes – below is the code you can use to easily simulate this early bound support in Silverlight.

    1. You need to create the attributes to use to decorate your early bound entities.

    [AttributeUsage(AttributeTargets.Property)]
    public sealed class AttributeLogicalNameAttribute : Attribute
    {
        public AttributeLogicalNameAttribute(string logicalName)
        {
            if (string.IsNullOrWhiteSpace(logicalName))
            {
                throw new ArgumentNullException("logicalName");
            }
            this.LogicalName = logicalName;
        }
    
        public string LogicalName
        { get; set; }
    
    }
    

     

    2. Create an early bound entity with the code to get/set the attribute values from the attribute collection – this is essentially the same as the SDK generated early bound types. For example, I'm using contact here:

    public class Contact : Entity
        {
            [AttributeLogicalName("contactid")]
            public Guid ContactId
            {
                get
                {
                    return this.GetAttributeValue<Guid>("contactid");
                }
                set
                {
    
                    this.SetAttributeValue("contactid", value);
    
                }
            }
    
            [AttributeLogicalName("fullname")]
            public string FullName
            {
                get
                {
                    return this.GetAttributeValue<string>("fullname");
                }
                set
                {
    
                    this.SetAttributeValue("fullname", value);
    
                }
            }
    
            [AttributeLogicalName("firstname")]
            public string FirstName
            {
                get
                {
                    return this.GetAttributeValue<string>("firstname");
                }
                set
                {
    
                    this.SetAttributeValue("firstname", value);
    
                }
            }
            [AttributeLogicalName("lastname")]
            public string LastName
            {
                get
                {
                    return this.GetAttributeValue<string>("lastname");
                }
                set
                {
    
                    this.SetAttributeValue("lastname", value);
    
                }
            }
        }
    

    3. Add extension methods to allow converting to the early bound types

    public static class ProxyTypeSupport
        {
            public static void SetAttributeValue(this Entity thisEntity, string attributeLogicalName, object value)
            {
                if (string.IsNullOrWhiteSpace(attributeLogicalName))
                {
                    throw new ArgumentNullException("attributeLogicalName");
                }
                thisEntity[attributeLogicalName] = value;
            }
    
            public static T ToEntity<T>(this Entity thisEntity) where T : Entity
            {
                if (typeof(T) == typeof(Entity))
                {
                    Entity entity = new Entity();
                    thisEntity.ShallowCopyTo(entity);
                    return (entity as T);
                }
               
                T target = (T)Activator.CreateInstance(typeof(T));
                thisEntity.ShallowCopyTo(target);
                return target;
            }
    
            public static void ShallowCopyTo(this Entity thisEntity, Entity target)
            {
                if ((target != null) && (target != thisEntity))
                {
                    target.Id = thisEntity.Id;
                    target.LogicalName = thisEntity.LogicalName;
                    target.EntityState = thisEntity.EntityState;
                    target.RelatedEntities = thisEntity.RelatedEntities;
                    target.Attributes = thisEntity.Attributes;
                    target.FormattedValues = thisEntity.FormattedValues;
    
                }
            }
        }

     

    4. Add code to retrieve, and convert the returned Entities into the early bound Contact Types.

    service.BeginRetrieveMultiple(query,
            (IAsyncResult asyncResult) =>
            {
            // Convert results to early bound Entity
            EntityCollection results = service.EndRetrieveMultiple(asyncResult);
            ObservableCollection<Contact> contacts = new ObservableCollection<Contact>();
    
            foreach (Entity lateBoundEntity in results.Entities)
            {
                contacts.Add(lateBoundEntity.ToEntity<Contact>());
            }
                           
            this.Dispatcher.BeginInvoke(() =>
            {
                this.dataGrid1.ItemsSource = contacts;
    
            });
                              
            }, null);

     

    This would also work in reverse to allow you to update values.

    Note: The example is not using MVVM pattern so as to make is simpler for readers.

     

    Download the code: CrmEarlyBoundTypesInSilverlight.zip (39.84 kb)

    Usual disclaimers apply: THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

    Posted on 8. April 2011

    Silverlight Theme for CRM2011

    Develop1 have a Silverlight 4 CRM 2011 theme available for the following user interface components:

    • Label Style
    • Text Box Style
    • Date Picker Style
    • Radio Button Style
    • Data Grid Style
    • Lookup Style (Coming soon)

    Please contact us for more information.