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.

per Feridun Kadir:  Update Rollup 17 for Dynamics CRM 2011 has been released.

Here is the download link:

http://www.microsoft.com/en-ph/download/details.aspx?id=42672

and the associated KB Article:

http://support.microsoft.com/kb/2915687

A new version of my JavaScript conversion utility, Transformer! for Dynamics CRM, will be available soon.

The purpose of Transformer! is to convert Dynamics CRM JavaScript from the 4.0 object model to the 2011/2013 object model.  In general, and depending on how your code was written, it will convert between 80-90% of the JavaScript into the CRM 2011 object model.

Your mileage may very since everyone writes code in a slightly different manner and using different coding techniques.

 

And I could use your help.  If you have run across a piece JavaScript that you feel could be automatically converted, I’d like you to send that code snippet to me so I can take a look.

OR, if you have never heard of Transformer! download the trial version and give it a shot.

 

Next Steps:

 

1. Download the Transformer! Trial Version Here:

http://www.crmaccelerators.net/products/transformer

 

2. Paste the code snippet into the CRM 4.0 conversion editor window.

 

3. Click the Convert button on the ribbon.

 

4. Send me the pre and post-conversion JavaScript.

mitch at crmaccelerators dot net

 

Notes:

Unfortunately, SOAP calls are beyond the scope of what Transformer! can handle so if your code is SOAP-related, Transformer! will not be of much help.

People who are successful in finding code that we can add to our list of conversions will be rewarded with a product discount or an Amazon gift card.

 

Thanks in advance for the help.

I verified a strange bug related to attachments and the deleting of the parent record chain.

  • If you delete an Email with an attachment it deletes the attachment.
  • If you delete a Contact with emails that have attachments the email is deleted but not the attachment.

For on-premise CRM administrators, you can use this script to find the orphans:

SELECT t1.*
FROM Attachment t1
LEFT JOIN ActivityMimeAttachment t2 ON t2.AttachmentId = t1.AttachmentId
WHERE t2.AttachmentId IS NULL

My assumption is that you would need to clean these up manually.

If you are using CRM Online, then you will have a much different story and one for which I do not have an answer.

In a nutshell, you need to use the CRM SDK write a small application that will compare the IDs in the Attachment table to those in the ActivityMimeAttachment table and produce a list of Attachments that are not connected to ActivityMimeAttachments, then delete those records.

Way back when, like in version 3.0 and 4.0, Dynamics CRM had a hidden page that would display a list of entities and attributes in a concise list.

That went away in version 2011 but the good folks on the CRM SDK team (Jim specifically), created a managed solution that was included in the SDK.

The main purpose of the tool is to show you information about CRM entities that does not show up on the normal CRM user interface through the dialogs associated with solutions.  This information is available, but only available via programmatic access.

My utility SnapShot! for Dynamics CRM uses exactly the same techniques to produce reports showing information not normally seen through the CRM UI.

 

Installation

After you have downloaded and installed the SDK, you can find the Metadata Browser here:

sdk\Tools\MetadataBrowser

Install the Metadata Browser as you would any other managed solution. When finished, open the solution and go to the Configuration page, where you can launch the different Metadata Browser components.

 

Metadata Browser

The first tool is the main Metadata Browser itself, which you activate by clicking the Open Metadata Browser button:

image

The interface looks like this:

image

As you click on an entity on the left-hand side, it’s properties will be displayed on the right.

At this point you can either view or edit the entity and its details.

 

Entity Metadata Browser

The second function will display a dialog that will allow you to edit an entity. This is the same dialog that is shown when you click the Edit Entity button on the Metadata Browser.

Here is what that interface looks like:

image

As you can see, you can edit or view any of the properties of the entity.

 

In conclusion, this is a simple yet powerful tool and one that is often overlooked but one which is great to have in your toolbox, should you need it.

Registration for next week's workshop on Dynamics CRM JavaScript Development closes this Friday – so don't miss out.

The goal of the class is for me to give you a very thorough introduction to using JavaScript within Dynamics CRM -  and we'll have just two days to do it.

When:
Wednesday, October 2nd and Thursday, October 3rd.

Where:
Online

What:
This is a hands-on workshop with each student provided their own virtual development environment for the duration of the class.

Cost:
$895 per person (multi-student discounts available)

Eventbrite - JavaScript Development with Dynamics CRM

Note: Due to the interactive nature of this workshop, it will be limited to 10 students.

Student Prerequisite Knowledge:

  • Each student must have working knowledge of Dynamics CRM 2011.
  • Knowledge of JavaScript is also required.

Note: For those students that have not worked with JavaScript previously, a short introduction webinar will be conducted on Monday, September 30th. Students attending this webinar will be expected to have completed the accompanying self-study materials before Wednesday's class begins. Everyone must be ready to run on Wednesday for the main class.

 

Agenda:

Each classroom day will run from 9:00am to 4:00pm (CDT) with the virtual environments available for student use until midnight on the 3rd.

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.

 

Please email me if you have any questions: mitch at crmaccelerators dot net

Version 2.0 of SnapShot! is now available.

Visit the SnapShot! product page to download the sample reports and get more detailed information.

With this update, I've added a report that will dump the raw Security Role data returned by CRM. Several people have requested access to the raw data, instead of having the pretty Word document containing all of the circles.

The report, in Excel format, looks something like this:

image

As you can see, we have the name of the Privilege, the Depth as a human-readable value, and the Depth as it is stored in the database.

This is a precursor to a feature that I would like to add that will perform a comparison of security roles, which should be available sometime before the end of the calendar year. In the mean time, you can create your own role comparison.

Version 3.3 of Explorer! for Dynamics CRM has been released.

This release fixes several bugs when extracting information from Dynamics CRM 4.0 and adds a new Bulk Analysis feature scans all entities and produces an Excel report showing the usage of all custom fields.

Visit the Explorer! product page for more information and to download a trial version.

We still have a few seats left in next week's webinar. The goal of the class is for me to teach you everything I know about plugin development and we'll have just two days to do it.

When:
Wednesday August 14th and Thursday August 15th

Where:
Online

What:
This is a hands-on workshop with each student provided their own virtual development environment for the duration of the class

Cost:
$895 per person (multi-student discounts available)

Eventbrite - Creating Plugins for Dynamics CRM

Note: Due to the interactive nature of this workshop, it will be limited to 10 students.

Agenda:

Day 1:

Wednesday is the bulk of our classroom work and we will cover the following topics:

  • Plugin architecture and design
    • The Dynamics CRM execution pipeline
    • The how, why, and where of plugging into Dynamics CRM
    • Performance considerations
    • Working in the sandbox
  • The development environment
    • Setup
    • Source control
    • Working in teams
  • Deploying plugins
    • To CRM
    • In a solution
    • To CRM Online (if applicable to the student population)
  • Debugging plugins
    • Synchronous vs. asynchronous
    • Full-trust vs. sandboxed

Day 2:

On Thursday we will be jumping into the development of custom workflow activities and other topics and will cover:

  • Custom activity architecture
  • Design features
  • Deployment
  • Asynchronous process monitoring
  • System job cleanup and maintenance
  • Open-lab time
  • Upgrade scenarios
  • Code-recovery of lost source plugin code

 

Thanks to our virtual development environments, the majority of our time will be spent actually designing and developing real-world plugins. Think labs. Lots and lots of labs.

Students will also be asked to bring one project with them that they would like to create while additional resources are available to them. This is strictly optional, but it is available.

In addition to the workshop materials, each student will receive additional tools and code templates to help increase their productivity as a Dynamics CRM plugin developer.

Finally, all students are free to keep any work produced during their lab-time as well as the tools and templates used in class.

Student Requirements:

Students need to understand Visual Studio and C# development and have working-knowledge of Dynamics CRM 2011.

 

Please email me if you have any questions:

mitch at crmaccelerators dot net

I am very excited to announce that my workshop on Dynamics CRM plugin development is now ready. The goal of the class is for me to teach you everything I know about plugin development and we'll have just two days to do it.

When:
Wednesday August 14th and Thursday August 15th

Where:
Online

What:
This is a hands-on workshop with each student provided their own virtual development environment for the duration of the class

Cost:
$895 per person (multi-student discounts available)

Eventbrite - Creating Plugins for Dynamics CRM

Note: Due to the interactive nature of this workshop, it will be limited to 10 students.

Agenda:

Day 1:

Wednesday is the bulk of our classroom work and we will cover the following topics:

  • Plugin architecture and design
    • The Dynamics CRM execution pipeline
    • The how, why, and where of plugging into Dynamics CRM
    • Performance considerations
    • Working in the sandbox
  • The development environment
    • Setup
    • Source control
    • Working in teams
  • Deploying plugins
    • To CRM
    • In a solution
    • To CRM Online (if applicable to the student population)
  • Debugging plugins
    • Synchronous vs. asynchronous
    • Full-trust vs. sandboxed

Day 2:

On Thursday we will be jumping into the development of custom workflow activities and other topics and will cover:

  • Custom activity architecture
  • Design features
  • Deployment
  • Asynchronous process monitoring
  • System job cleanup and maintenance
  • Open-lab time
  • Upgrade scenarios
  • Code-recovery of lost source plugin code

 

Thanks to our virtual development environments, the majority of our time will be spent actually designing and developing real-world plugins. Think labs. Lots and lots of labs.

Students will also be asked to bring one project with them that they would like to create while additional resources are available to them. This is strictly optional, but it is available.

In addition to the workshop materials, each student will receive additional tools and code templates to help increase their productivity as a Dynamics CRM plugin developer.

Finally, all students are free to keep any work produced during their lab-time as well as the tools and templates used in class.

 

Please email me if you have any questions:

mitch at crmaccelerators dot net

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