Category Archives: Development

My development efforts ( mostly Microsoft .NET )

Source code recovery tip: Was this written in c# or VB.NET?

Every now and again I run into the unfortunate circumstance where someone has lost the source code to a Dynamics CRM plugin (or something similar).

When you encounter this type of situation your only hope is to decompile the source using the plugin assembly’s DLL file and spend a good deal of time modifying the source code to get close to what the original author wrote.

Today my tool of choice is JustDecompile from the fine folks at Telerik.

Decompilation is not an exact science simply because the code the compiler ended up generating is not exactly like the code the author wrote. Most of the time this is caused by optimizations that the compiler has inserted which replace the original author’s code with code that it thinks is “better” or in some cases, just because.

So when reviewing a decompilation, it is sometimes hard to make a determination if what you see is compiler-generated or user-generated, especially when it is not your code. And I should note that I have seen a lot of code written by people whose main job was not that of a developer, who grabbed some code out of the Dynamics CRM SDK or off of the Internet to solve a problem, without really knowing what they were doing.

So when you look at the decompiled code, you are always asking: did they write it this way, or is this the way it was compiled?

Today I ran into something quite different.

First off, the using statements look very strange:

image

And some of the comparison operations used methods that I had never seen before:

image

Which is in the Microsoft.VisualBasic.CompilerServices namespace. 

Very odd.  Why would a developer writing C# use Visual Basic.NET assemblies?

The answer is: They would not.  This code was originally written in VB.NET, not C#.

So I am still going to use the C# decompilation code, but knowing that this was originally written in VB.NET helps me understand a little bit better some of the code that I am seeing.

Just another note to put into your book somewhere.

Upcoming Training: JavaScript Development with Dynamics CRM 2015

Hi Everyone,

I am holding my JavaScript development workshop in conjunction with the CRMUG Academy.

Visit this page to register.

Here are the details:

The goal of this 2 day class is to provide every student with a very thorough introduction to using JavaScript within Dynamics CRM. This is an Internet-based, hands-on workshop with each student provided their own virtual development environment for the duration of the class. Each classroom day will run from 10:45am to 5:00pm Eastern with the virtual environments available for student use until midnight on the second day.

And thanks to our virtual development environments, the majority of our time will be spent actually developing JavaScript solutions for Dynamics CRM. Think labs. Lots and lots of labs. And homework. There will be homework.

We’ll cover the following topics:

  • Creating a development environment ?Setup

    • Source control

    • Working in teams

    • Working with Visual Studio

  • Working with Web Resources

  • Working with Solutions

  • Working with Forms ?JavaScript libraries

    • Form events

    • Form Event Handler Execution Context Reference

  • Working with the Xrm.Page Object Model ?Working with Collections

    • Data operations

    • Tabs and Sections

    • Working with Controls

    • Working with iFrames

    • Working with Navigation Items

  • Ribbon button and JavaScript connection

  • Opening Dynamics CRM Forms and Web Resources via JavaScript

  • Using the XrmSrcToolkit to CRM-related data operations

We will be using about 75 of the methods found in the Xrm.Page object model so you should leave class with a fairly good understanding of where things are and how to access them. If we have time, we will also cover some of the freely available JavaScript components that can be used to aid in your development efforts and to increase your user’s productivity.

Students will also receive a draft copy of my upcoming book on Dynamics CRM JavaScript development along with sample code and utility web resources that should help you kick start your CRM JavaScript development efforts.

Using the XrmSvcToolkit to perform the following operations using JavaScript:

  • Create

  • Retrieve

  • Update

  • Delete

We will also be covering advanced topics such as working with the Dynamics CRM tablet client.

Student Prerequisite Knowledge:

  • Each student must have working knowledge of Dynamics CRM 2011, 2013, or 2015.

  • Knowledge of JavaScript is also required.

Preparation: The detailed instructions for connecting and attending the class will be sent one to two days prior to class. Students have the option of connecting to the class via conference call or VOIP. If using VOIP, a headset with a microphone is strongly recommended. Your instructor will use a hands-on training environment. You will receive a separate email with the setup instructions, and a dual monitor is strongly recommended to facilitate navigation.

Let me know if you have any questions.

Thanks, Mitch

Dynamics CRM Developer Tip O’ the Day: Working with Tabs

I learned an important lesson yesterday, again, on working with tabs with Dynamics CRM forms.

There are several ways to reference tabs when writing JavaScript and using the Xrm.Page model.  You may reference the tab by number, like this:

Xrm.Page.ui.tabs.get(2)

Note: Tabs are numbered starting with zero for the first tab.

Or by name, like this:

Xrm.Page.ui.tabs.get("tab2Tab")

It is always a best practice to use the name of the tab instead of the number because if you ever move the tab around the form, then the number will no longer be valid and any JavaScript you have written which references a particular tab in such a manner will start to cause some very strange user experiences.

By using the name of the tab, you will always be referring to the same tab, no matter where it may be located on the form.

In my particular case, this was a Dynamics CRM 2013 installation that had been upgraded from 4.0.  My JavaScript conversion tool, Transformer!, automatically converts the tab references using the number because of the naming convention applied to the converted forms, which is a GUID.

I had merged the original Information form with the new Entity form and in doing so, I had inadvertently moved the tabs out of place.  The logic in JavaScript involved changing the title of a tab as well as showing and hiding one of two different tabs, based on the value of an Option Set field.

I worked around my issue by renaming my tabs from the GUID value to tabxTab, which was the original CRM 4.0 naming format then modified my JavaScript to use that name instead of the number.

By the way, the same practice also applies to form Sections, which are named and referenced in a similar manner.

Visual Studio: Where did my macros go

 

So I have this open-source project that I created a couple of years ago that helps the Dynamics CRM .NET developer upgrade their code from Dynamics CRM 4.0 to the programming model we now use with Dynamics CRM, which started with Dynamics CRM 2011.

I have only had 68 downloads of this project since it was uploaded, and I have always thought that was rather low.  This week, when I went to use it myself, I found out why:  Microsoft decided to remove the Macros capability in Visual Studio 2012.

Their official statement was that their usage data showed that less than 1% of developers used that feature.  I guess this is one of those few times in life that being in the 1% is just not good, huh?

Alternatives

It does, however, look like there may be some help circumventing this problem, in the form of Visual Studio extensions:

I have yet to try either of these, and I am sure there are others, so if anyone has any experience with running and/or editing macros created with Visual Studio 2010 or before, I’d like to know about it.

Vote It Up!

Here is the UserVoice topic was created to give feedback on bringing back macros as built-in functionality. You can add your vote , if you so wish:

https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2650757-bring-back-macros

Recommendation: Aspose Words and Cells

Several of my tools generate Microsoft Excel and Word documents as part of their output and for the longest time, I have used various open-source libraries to provide me with OpenDocumentXML functionality to generate real worksheets and documents, instead of just CSV and plain text files.

The only problem, especially with my SnapShot! documentation utility, was the amount of time it was taking to generate documents. SnapShot! generates a ton of worksheets and documents and I was growing increasing concerned with the generation time.

So I started looking around for alternatives and I kept coming back to a company celled Aspose.  I have been looking at their components for years and they have two products that I needed:

Aspose.Cells, for generating Microsoft Excel files and Aspose.Words for generating Microsoft Word documents.

Full disclosure: They offer a free copy of their component libraries to Microsoft MVPs so I took them up on their offer.

Let me just say that I am extremely impressed with both Cells and Words.  Extremely impressed.

Not only are their components easy to use, but they are blazingly fast.

Working on SnapShot!, I took me about about 1.5 hours to move both my worksheet generation and document generation from the OpenDocumentXML libraries to Cells and Words. And that is including reading their documentation to figure out how to do things like:

  • Automatically generate tables of content
  • Insert figures into a Word document
  • Word headers and footers
  • Turning on filtering on an Excel worksheet
  • Creating a workbook containing multiple worksheets
  • etc.

And did I mention fast?  Oh My Gosh! Fast.

Cells generates Excel worksheets like it is being paid by the row and it’s almost 5:00pm on Friday night.

The combination of Cells and Words sped up the document generation process between 40% and 50%, depending on the data being extracted from Dynamics CRM.

Again, I am very impressed with the quality and speed of this product.  I don’t give out recommendations often, but this is surely one of them.

And don’t forget that Cells and Words are just two components in their library. I can’t wait to get to use some of the others, like Aspose.Diagram, which generates Microsoft Visio diagrams. Think about that as you are creating your own documentation…

Anyway, that’s my recommendation for today.  Take a look if you have time and interest.

Developing applications for multiple versions of Dynamics CRM

As most of you know, I have a several add-on products for Dynamics CRM developers, administrators, and consultants.

They all share common user interface and application frameworks that I developed several years ago.

When I first started writing these tools all I had to worry about was Dynamics CRM 4.0, which was pretty easy. Then Dynamics CRM 2011 shipped, which made things a bit more difficult, but not impossible.

I just had to separate my internal components so that one section worked with CRM 4.0, and the other with CRM 2011.  Once I got the unified connection user interface component working correctly, everything else just fell into place and things were all warm and cozy.

CRM 4.0 and CRM 2011 communicate over very different means so even though you ask for a single set of information from the user, you must appropriately handle the connection specific to the platform on the back-end.  That took a little bit of work to make happen flawlessly every time.

Then Microsoft shipped Dynamics 2013.  Still not a big deal as I could use the CRM 2011 SDK assemblies to communicate without any issue.

Then Microsoft shipped Dynamics 2015 and I started thinking that maybe I need to re-examine my methodology.  And I am quite happy with my solution.

 

Requirements

I need to communicate with Dynamics CRM 2011, 2013, and 2015 while changing the smallest amount of code possible.

I also had to stay with .NET 4.0, since my user interface framework does not support .NET 4.5 and I was not in a position to write the entire UI for a handful of products.

 

Solution

The solution was to upgrade my SDK .NET assemblies to the Dynamics CRM 2013 level. 

That gave me access to all three platforms as long as I kept in mind that I could never ask for something that did not exist on a specific platform. 

Like SLAs or Entitlements from CRM 2011. Since those do not exist until 2013, it would throw an error.

 

Further Thoughts

For some reason, I had never tried connecting to a lower-version environment using the newest SDK assemblies.  Turns out that works just fine. (silly me for never asking the question till a month ago).

If my UI framework was .NET 4.5 compatible, I would have jumped up to the CRM 2015 assemblies because that is what they are written with.

The only side-effect to this is that I am stuck using Visual Studio 2010 because that same UI framework doesn’t work with Visual Studio 2013, my normal environment.

 

Conclusion

This process was quite eye-opening for me and just about as painless as it could be.  The Microsoft SDK team has done a huge amount of really great work that makes our jobs as developers, much less work than it could be, or even once was.

Let me know if you have had similar or even different experiences.

Troubleshooting Dynamics CRM: The Mother of all call stacks

So one of my customers ran into this issue while opening an Opportunity.  As you can see, a custom plugin was throwing an exception because it could not find a Account with a specified ID.

SNAGHTML5c035ae

That part is 100% correct.  The Account with that ID indeed does not exist in the database.

The problem is, this plugin should never have been fired. As I mentioned, this was happening on a Retrieve operation and there are no plugins registered against the Retrieve Message.

So I waited until tonight so I could turn on Tracing (on-premise, of course), and this is what I found:

[2014-10-16 20:12:57.600] Process: w3wp |Organization:d98bbf24-8eed-4cb4-a379-6aa848499cb0 |
    Thread:   25 |Category: Exception |User: fb9a439c-b578-4a4b-83e0-39ea0059ad2a |
    Level: Error |ReqId: eb0bc9e4-e6e6-4552-b322-1c2fa0bdbc10 | 
    CrmException..ctor  ilOffset = 0x7

    at CrmException..ctor(String message, Exception innerException, Int32 errorCode,
       Boolean isFlowControlException)  ilOffset = 0x7

    at CrmException..ctor(String message, Exception innerException, Int32 errorCode)  ilOffset = 0x5
    at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig,
       Boolean constructor)  ilOffset = 0xFFFFFFFF

    at RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder,
       Object[] parameters, CultureInfo culture)  ilOffset = 0xF7

    at RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args,
       CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)  ilOffset = 0x1E8

    at Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args,
       CultureInfo culture, Object[] activationAttributes)  ilOffset = 0xBB

    at Activator.CreateInstance(Type type, Object[] args)  ilOffset = 0xA
    at VersionedPluginProxyStepBase.WrapExceptionToThrow(CrmException exception)  ilOffset = 0xD3
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory,
       IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, 
       Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, 
       CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId,
       Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156

    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken,
       CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, 
       Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145

    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken,
       CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x3D

    at OrganizationSdkServiceInternal.Retrieve(String entityName, Guid id, ColumnSet columnSet,
       CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x66

    at InprocessServiceProxy.RetrieveCore(String entityName, Guid id, ColumnSet columnSet)  ilOffset = 0x28
    at OrganizationServiceProxy.Retrieve(String entityName, Guid id, ColumnSet columnSet)  ilOffset = 0x4
    at Utility.UpdateAccountKeyword(IOrganizationService service, Guid accountId)  ilOffset = 0xE8 
        C:\Plugins\SupportingClasses\Utility.cs(205)

    at InvoiceCancelOpportunityCloseKeywords.Execute(IServiceProvider serviceProvider)  ilOffset = 0x164 
        C:\Plugins\InvoiceCancelOpportunityCloseKeywords.cs(70)

    at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0xD0
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1FB
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)  ilOffset = 0x0
    at ExtensiblePlatformMessageDispatcher.UpdateWithInvocationSource(BusinessEntity entity, FilterExpression filter,
       Int32 invocationSource, ExecutionContext context)  ilOffset = 0xCE

    at ExtensiblePlatformMessageDispatcher.Update(BusinessEntity entity, FilterExpression filter, ExecutionContext context) 
       ilOffset = 0x5

    at BusinessProcessObject.UpdateWithPipelineAndExtensions(IBusinessEntity entity, ExecutionContext context)  ilOffset = 0x78
    at QOIPriceService.UpdateEntity(BusinessEntity newQoi, BusinessEntity oldQoi, ExecutionContext context)  ilOffset = 0x87
    at PriceService.CalculatePrice(BusinessEntity entity, Guid lineItemId, Boolean skipQOIDetailPricing,
       Boolean overridePricePerUnitLock, Boolean overrideDiscountLock, ExecutionContext context)  ilOffset = 0x6E1

    at OpportunityPriceService.CalculatePrice(BusinessEntity entity, Guid lineItemId, Boolean skipQOIDetailPricing,
       Boolean overridePricePerUnitLock, Boolean overrideDiscountLock, ExecutionContext context)  ilOffset = 0x70

    at QOIPriceService.CalculatePrice(Guid qoiId, Guid lineItemId, Boolean skipLineItemPricing, Boolean overridePricePerUnitLock,
       Boolean overrideDiscountLock, Boolean isModifiedBySystem, ExecutionContext context)  ilOffset = 0x2E

    at OpportunityService.CalculatePrice(Guid opportunityId, Guid opportunityProductId, Boolean skipOpportunityProductPricing,
       Boolean overridePricePerUnitLock, Boolean overrideDiscountLock, Boolean isModifiedBySystem, ExecutionContext context) 
       ilOffset = 0x12

    at QOIService.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context,
       Boolean isModifiedBySystem, Boolean calculatePrice, Int32 state)  ilOffset = 0x2D

    at OpportunityService.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression,
       ExecutionContext context)  ilOffset = 0x14

    at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig,
       Boolean constructor)  ilOffset = 0xFFFFFFFF

    at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) 
       ilOffset = 0x25

    at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder,
       Object[] parameters, CultureInfo culture)  ilOffset = 0x89

    at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x4F
    at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x57
    at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x58
    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory,
        IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, 
        Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, 
        CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, 
        Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x156

    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken,
        CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, 
        Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x145

    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken,
       CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x3D

    at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken,
       CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24

    at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
    at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    at RetrieveCommand.Execute()  ilOffset = 0x2
    at EntityProxy.Retrieve(String[] columns, Guid auditingTransactionId, Boolean addRequiredColumns)  ilOffset = 0x69
    at EntityProxy.Retrieve(String[] columns, Guid auditingTransactionId)  ilOffset = 0x4
    at EntityProxy.Retrieve(String columnSet, Guid auditingTransactionId)  ilOffset = 0xB
    at EntityProxy.Retrieve(String columnSet)  ilOffset = 0x7
    at AppForm.FormLoadEvent()  ilOffset = 0x11
    at AppForm.RaiseDataEvent(FormEventId eventId)  ilOffset = 0xC7
    at EndUserForm.Initialize(Entity entity)  ilOffset = 0x1F
    at CustomizableForm.Execute(Entity entity, FormDescriptor fd)  ilOffset = 0x62
    at RecordPageHandler.ConfigureFormWrapper()  ilOffset = 0xC
    at GenericEventProcessor.RaiseEvent(String eventName)  ilOffset = 0x2D
    at PageManager.OnPreRender(EventArgs e)  ilOffset = 0x47
    at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
    at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x6D3
    at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
    at Page.ProcessRequest()  ilOffset = 0x14
    at Page.ProcessRequest(HttpContext context)  ilOffset = 0x33
    at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
    at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10A
    at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0x16A
    at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x4B

That is 75 calls, if you didn’t feel like counting, and in the middle of all of that was the failing call to my plugin.

The nearest thing I can figure is that this Opportunity is set to be System Calculated and when it was opened, a update to the revenue numbers. This ended up firing my plugin which failed because data that was passed to it turned out to be invalid.

I temporarily disabled the plugin and was able to save the Opportunity and correct the invalid data issue.

I could not have done this troubleshooting without the following tools:

If you do not have these tools in your toolbox, you need to fix that today.

GotoMyPC as a Mobile Developer Productivity Tool

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.

New tool for Dynamics CRM Developers: CRM REST Builder

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.