Kids, don't try this at home!

Tips & Tricks for C#, ASP.NET and CRM

December 2010 - Posts

Automatically share a personal view with another user

 

Recently we needed to share personal views with a system/service user to draw Bing maps. (keep an eye out for a cool blog post about geo mapping and geo boundary integration with advanced find views).

Advanced Find views are stored under the userquery entity; unfortunately this entity is marked as private by CRM, meaning we’re not able to register plugins, there is an unsupported work around though.

If you open up the SdkMessageFilter table and set IsCustomProcessingStepAllowed to 1 on the userquery entity you’ll be able to register plugins under the userquery entity.

Next step is to create the plugin and write some code to share this advanced find view with another user, to do this programmatically use the code below.

GrantAccessRequest request = new GrantAccessRequest
{
    PrincipalAccess = new PrincipalAccess
    {
        AccessMask = AccessRights.ReadAccess,
        Principal = new SecurityPrincipal
        {
            PrincipalId = userId,
            Type = SecurityPrincipalType.User
        }
    },
    Target = new TargetOwnedDynamic 
    { 
        EntityId = queryId, EntityName = "userquery" 
    }
};

To get the queryId use the Input/OutputParameters of the IPluginExecutionContext, to view other parameters that are passed in via the IPluginExecutionContext use our mSpy tool (http://mspy.codeplex.com), it takes the guess work out of writing plugins!

Posted: Dec 09 2010, 07:33 PM by gperera | with no comments
Filed under:
Putting a clock to the face in a Dynamics CRM Record

This is an enhancement to the blog post that was written last week about how to put a face to the name in a Dynamics CRM record. As you can see from the above image we also added the option to see the local time of a contact in CRM.

If you’re working with people around the globe it’s useful to know what time it’s on their side of the world so you don’t wake them up at 2am in the morning doing a sales call!

How does it work?

Very simple, using jquery we make a call to Google (sorry Bing, tried to use your services but you didn’t like me asking ‘time in xyz’) then parse the html and show the result.

Posted: Dec 06 2010, 09:02 PM by gperera | with no comments |
Filed under:
Putting a Face to the Name in a Dynamics CRM Record

 

We recently added a neat little customization to a Microsoft Dynamics CRM 4 organization so that when you open a contact record it goes off to LinkedIn, finds the persons picture if there is one and displays it on the contact record.

It’s very similar to the Social Connector in Outlook, if you’d like this customization in your environment contact me or if you’re a developer here’s how you can write it from scratch.

LinkedIn Gotcha

LinkedIn has an API which uses OAuth but it requires the user to login to LinkedIn and get redirected back which renders this kind of application to application communication useless. One interesting thing to note is that the Outlook Social Connector works without user interaction because it was written by LinkedIn and uses some backdoor into their system to match contacts via email addresses.

Luckily there is a public search - http://www.linkedin.com/pub/dir/?first={0}&last={1}, if you pass a person’s first and last names it’ll return a list of matching records, unfortunately there’s no way to pass the company name to the public search.

Once you have the raw html from the public search results page, simply parse the html, create a little algorithm to match the company and return the best matching result.

You can try it out here http://magic.magnetism.co.nz/linkedin.htm

Enjoy!

Posted: Dec 02 2010, 09:07 PM by gperera | with no comments |
Filed under:
More Posts