top border

Ben Klopfer's Blog

 Ben Klopfer Headshot

Ben Klopfer, Technology Solutions Manager

Ben Klopfer, eImagine's Technology Solutions Manager, has been with the company since 2008. He began his career designing quality assurance software for Time Warner's distribution warehouses in 2002. Ben is one of eImagine's highly certified individuals, a Microsoft Certified Professional Developer in ASP.NET with additional certifications in SharePoint and CRM. Ben specializes in architecting rapid and creative solutions using C#, VB.NET, Microsoft Dynamics CRM, and various database platforms. He also enjoys developing unique apps for Windows Phone 7 in Silverlight using the MVVM design pattern. Ben is a solutions expert, and prides himself in seeing problems only as great opportunities for technical solutions.

Back to eImagine Blogs
  • Error in Send E-mail Step of Workflow Process - Solution [TUTORIAL]

    Bug found in lines of code under magnifying glass

    Update: I was able to reproduce this problem, and have reported it to Microsoft as a bug for resolution. Please vote for it as an important fix so it can be resolved in the next Rollup Update!

    Let me tell you a little story about a bug...

    I had just completed a complex workflow process in Microsoft Dynamics CRM 2011. The workflow checks a number of conditions and then sends one (of any numerous) email templates to a distribution group filled with dynamic fields from the primary and related entities. It was painstaking created, tested, and modified several times until the conditions and templates were perfect. Then, I simply updated the "To" fields to make it live... But upon the first execution, no email went out and I got the error:

    An error has occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization's Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.

    No problem, I thought, I'll just go back in and mess with the Send Email steps that are failing to figure out what the problem is. But when I went to click the "View Properties" or "Edit Properties" to see/change the created email record, I got a CRM unhandled exception with the following stack trace:

    [IndexOutOfRangeException: Index was outside the bounds of the array.]
    at Microsoft.Crm.Application.Platform.WorkflowLibrary.WorkflowAdapter.GetEntityProperty( ExpressionBase propertyExpression)
    at Microsoft.Crm.Application.Platform.WorkflowLibrary.WorkflowAdapter. GetEntityPropertyForProperty(PropertySpecification property, String uiXmlName, String& slugInfo)
    at Microsoft.Crm.Application.Platform.WorkflowLibrary.WorkflowAdapter.PopulateEntityProperties( EntitySpecification entitySpec, EntityBase entity, String uiXmlName)
    at Microsoft.Crm.Web.Sfa.EntityForm.get_FormEntity()
    at Microsoft.Crm.Web.Sfa.EntityForm.ConfigurePage()
    at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)
    at System.Web.UI.Control.PreRenderRecursiveInternal()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    [HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown.]
    at System.Web.UI.Page.HandleError(Exception e)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.ProcessRequest()
    at System.Web.UI.Page.ProcessRequest(HttpContext context)
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication. IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    Now I was stuck--I didn't want to recreate the entire workflow manually and painstakingly test over and over again manually. No one had ever heard of this problem, and I couldn't find anything online about how to solve it.

    To solve it, I exported the workflow and dug through the XAML to find the root of the problem. When I created the Send Email steps in my workflow, I had filled out the "To" and "CC" fields with User accounts for testing purposes. When I modified it to make it "live," I changed the "To" entity record (to the live distribution list Contact record) and completely cleared the "CC" field. However, for some reason CRM still had a pointer doing and entity record lookup for the "CC" field, and it was failing to look it up because there was no record indicated (the field was blank).

    I noticed in the XAML there was a SetEntityProperty in the Send Email sequences that shouldn't be there for a blank "CC" field. Something like this:

    <mxswa:SetEntityProperty Attribute="cc" Entity="[CreatedEntities(&quot;SendEmailStep1_localParameter#Temp&quot;)]" EntityName="email" Value="[SendEmailStep1_1]">
    <mxswa:SetEntityProperty.TargetType>
    <InArgument x:TypeArguments="s:Type">
    <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="mxs:EntityCollection" />
    </InArgument>
    </mxswa:SetEntityProperty.TargetType>
    </mxswa:SetEntityProperty>

    The ActivityReference for SendEmailStep1_1, however, contained a weird stub for an empty PartyList. This was causing the Index out of Range lookup error, which was crashing CRM:

    <mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EvaluateExpression, Microsoft.Crm.Workflow, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EvaluateExpression">
    <mxswa:ActivityReference.Arguments>
    <InArgument x:TypeArguments="x:String" x:Key="ExpressionOperator">CreateCrmType</InArgument>
    <InArgument x:TypeArguments="s:Object[]" x:Key="Parameters">[New Object() { Microsoft.Xrm.Sdk.Workflow.WorkflowPropertyType.PartyList }]</InArgument>
    <InArgument x:TypeArguments="s:Type" x:Key="TargetType">
    <mxswa:ReferenceLiteral x:TypeArguments="s:Type" Value="mxs:EntityCollection" />
    </InArgument>
    <OutArgument x:TypeArguments="x:Object" x:Key="Result">[SendEmailStep1_1]</OutArgument>
    </mxswa:ActivityReference.Arguments>
    </mxswa:ActivityReference>

    The solution was to remove the offending references to the "CC" field and associated activities. Problem solved! And that's the last time I use the "CC" field for testing purposes without backing up my workflows first!!!

    eImagine is an Indianapolis-area leader in Microsoft Dynamics CRM. Whether you're looking for an out-of-the-box CRM implementation, and highly customized solution, or an XRM-based extended CRM product, we're the local company with the expert staff to get it done! Learn about our CRM experience.

    Full story

    Comments (0)

  • Microsoft + Nokia = <3

    Nokia Hearts Microsoft

    Microsoft did a great job at the Consumer Electronics Show (CES) this year. I'm looking forward the to Microsoft and Nokia partnership, especially with the impact it could have on the number of Windows Phone 7 devices out in the wild. They just introduced the Lumia 900 on AT&T's 4G LTE network. I've developed 30+ apps for Windows Phone 7, and while they have been popular, I know that Apple iPhone counterparts would have been even more popular (and profitable!). It's really a numbers game--the more phone you have, the more people there are to buy your apps. If Nokia is able to give Microsoft a much needed jump start in phone sales, that would be great!

    Microsoft and Nokia are already getting plenty of good press as "winners" at CES 2012. I'm crossing my fingers they make some great strides this year!

    Nokia's press release: http://press.nokia.com/2012/01/09/nokia-and-att-introduce-the-new-nokia-lumia-900-on-atts-4g-lte-network/

    Full story

    Comments (0)

  • Imagine the Impact of New Years Resolutions

    Champaign Toast! Happy New Year!

    I have been going to the gym on the same regular schedule for the past 2 years. Every January the locker room is flooded with resolutioners who have made a pledge to be more fit for the New Year. This year, not even halfway through January the new crowd has already decreased significantly. By February, it will be back to regulars only.

    I was thinking about it and not only are resolutions broken, but they're also boring. Take a look at this list of the same-old same-old New Year's Resolutions I've heard people pledge this year:

    1. Start a gym/diet.
    2. Cut down smoking/drinking.
    3. Go back to school.

    Personally, I don't make resolutions, I make goals. And I make them all year round. What's more, my goals are specific and not generalized statements I can wiggle around and rationalize not getting done. Many of my life goals revolve around business goals because, well let's face it, like most of us work so we can live! So why not take those traditional goals and turn them in to business goals for yourself!

    Here are some ideas to get you started. Imagine the impact if everyone at your office did this!

    Start a Gym/Diet = Get Organized

    Fit is efficient, and every employee can benefit from being organized and more efficient. It's time to bulk up your calendar, tasks, and spreadsheets. Get everything up to date and actually use the systems you put in place for yourself. If you don't keep it up, you'll lose all that newly established muscle tone!

    Put your desk filing cabinet on a diet! Go through your desk drawers and guarantee at least 50% of what you find you can throw out. Then, you'll be able to find the actual document you are seeking next time without wading through garbage. Don't forget to maintain that diet or the weight will come right back!

    Cut Down on Smoking/Drinking = Break Bad Office Habits

    Do you read too much Wikipedia during work? Or spend too much time browsing Facebook? We all have some bad office habits that we can break. Whether it's putting the phone in your pocket so you can't respond to text messages all day or just keeping your internet browsing to a minimum, you know which habits are bad and how to break them. Make it a goal, the results will be great!

    Go Back To School = Master a New Skill

    It's easy to fall in to a pattern as an employee and stop learning new things for your career. This is especially true if you have been working on the same product, service, or client for a long period of time. Learning something new can give you additional perspective on your work making it exciting again, or you can at least stay up to date on the world around you. You'd be amazed what a weekend of dedication does toward mastering a new technical skill.

    Full story

    Comments (0)

  • The Project Management Balance

    Dilbert Comic

    I think, as developers, we've all experienced projects with too much project management. There's nothing worse than being micro-managed by multiple, non-technical bosses that make the documentation and paperwork suck up all your time. Whether it's having six direct bosses, or a ridiculous hierarchy of supervisors, getting caught up in the politics gets unavoidable. Come on people, us software developers just wanna work!

    But I've seen the flip side too. Being held accountable for successful project execution, I've seen projects start to really go off the rails if they don't have a project manager engaged. Developers aren't typically thinking about budgets and time, or planning out careful milestone delivery. It's easy for a company to get upside down on a project when those things aren't monitored.

    So what's the right balance? It can be tough to not only have the right amount of PM involvement. How many meetings is enough? How many is too many? Unfortunately, I've found it is all variable depending on the developers, project, and size of the team. Using an agile methodology, like eImagine practices on most projects, can certainly help buffer major projects and eliminate missed milestones for clients. However, it seems to always be a living, breathing creature that is evolving with every new project and task. Stay adaptable!

     

     

     

    Full story

    Comments (0)

  • Displaying More Exciting Chart Types in CRM 2011 [TUTORIAL]

     Cool Area Chart Example

    At eImagine, we do some pretty cool dashboarding in our CRM implementation. Unfortunately, Microsoft Dynamics CRM 2011 only supports 5 standard (read: boring) chart types out of the box: Column, Bar, Line, Pie, and Funnel. Well, I take that back--Funnel is exciting, but the other 4 are definitely boring.

    CRM 2011 Out-of-the-box Chart Types

    However, since CRM uses the standard .NET Framework Chart control, it is an undocumented feature that you can extend the charting visualizations to take advantage of many other chart types. And, even better, this can be done without development extension of the control! Here are instructions to easily change the chart type of an existing or newly created chart in CRM:

    1. Navigate to Settings > Customization > Customize the System.
    2. In your soluton, navigate to Entities > (Target Entity) > Charts.
    3. Select the chart you wish to change and choose Export.
    4. Save the resulting XML and open it in Visual Studio or any text editor.
    5. Scroll to the Series element and modify the ChartType property.
    6. Save and import the XML as a new chart.

    Code snippet XML element modification

     Here are all the supported chart types you can use:

    ChartType

    Description

    Area

    Area chart type. 

    Bar

    Bar chart type. 

    BoxPlot

    Box plot chart type.

    Bubble

    Bubble chart type. 

    Candlestick

    Candlestick chart type. 

    Column

    Column chart type. 

    Doughnut

    Doughnut chart type. 

    ErrorBar

    Error bar chart type.

    FastLine

    FastLine chart type. 

    FastPoint

    FastPoint chart type. 

    Funnel

    Funnel chart type. 

    Kagi

    Kagi chart type. 

    Line

    Line chart type. 

    Pie

    Pie chart type. 

    Point

    Point chart type. 

    PointAndFigure

    PointAndFigure chart type. 

    Polar

    Polar chart type. 

    Pyramid

    Pyramid chart type. 

    Radar

    Radar chart type. 

    Range

    Range chart type. 

    RangeBar

    RangeBar chart type. 

    RangeColumn

    Range column chart type.

    Renko

    Renko chart type. 

    Spline

    Spline chart type. 

    SplineArea

    Spline area chart type.

    SplineRange

    Spline range chart type.

    StackedArea

    Stacked area chart type.

    StackedArea100

    Hundred-percent stacked area chart type.

    StackedBar

    Stacked bar chart type.

    StackedBar100

    Hundred-percent stacked bar chart type.

    StackedColumn

    Stacked column chart type.

    StackedColumn100

    Hundred-percent stacked column chart type.

    StepLine

    StepLine chart type. 

    Stock

    Stock chart type. 

    ThreeLineBreak

    ThreeLineBreak chart type. 

    Full story

    Comments (0)

  • Are All Developers ADHD?

     Reb Bull Fighter Jet

    I don't know what it is about software development, but I just can't stop once I get on a roll. I know many other developers who feel the same way. In fact, I don't think I have met one who doesn't feel that way. Everyone knows the stereotype of developers up all night, working while being sustained by Red Bull and Mountain Dew Code Red... In my experience it really is true. So I ask, what is it about development that seems to bring out the over-focus of ADHD in otherwise non-affected people?! For the record, I am not ADHD in daily life. But once I get started on development, I just want to keep going until I drop or finish the project. Then I fall asleep thinking/dreaming about enhancements, improvements, or "ah-ha" moments of clarity for problem resolution.

    Agree? Disagree?

    Update: Maybe I am ADHD... I can't stop thinking about actually constructing that Red Bull jet plane.

     

     

    Full story

    Comments (2)

  • CRM 2011 Custom Direct URL Link Field Using JavaScript [TUTORIAL]

    Outlook Screenshot Direct URL Link Email

    Microsoft Dynamics CRM is a powerful tool for automating and tracking business processes. It's built in workflow processes allow you automate processes easily to your business's own specific requirements. A built-in process that most people have set up are automated emails that are sent out with record-specific information. CRM 2011 makes this easy by allowing you to insert contextual dynamic fields directly in to the body and other fields of the email itself. However, one very useful field is absent--a direct link to the record.

    It is only natural to set up a email notification with some summary data and a "Click here for more information" link. But in CRM, there is no obvious way to generate the link that points to the target record. This is a much requested feature by businesses, as it cuts down on record hunting in CRM in these situations.

    So, here is a tutorial on how to set up a custom field that can be used to easily and reliably generate direct URL links to records.

    Create the Web Resource:

    CRM Screenshot Web Resources

    1. Go to Settings > Customization > Customize the System.
    2. Select Components > Web Resources.
    3. Click the New button and create a new Web Resource.
    4. Fill in the following fields:
      1. Name: direct_url_resource.js
      2. Display Name: direct_url_resource.js
    5. For Type click the Text Editor button.
    6. Paste in the script from [direct_url_resource.js] below.
    7. Save and publish your Web Resource.

    Create a Custom Field: 

    1. Go to Settings > Customization > Customize the System.
    2. Select Components > Entities > (Target Entity) > Forms.
    3. Edit the main form.
    4. Click the New button to create a new custom field.
    5. Fill in the following fields:
      1. Display Name: Direct URL
      2. Name: new_direct_url
      3. Type: Single Line of Text
      4. Maximum Length: 2000

    CRM Screenshot Custom Field

    Customize Your Entity:

    1. Add your new field to the form. Double click it to open Field Properties.
    2. Under Display > Visibility uncheck the "Visible by default" setting and save.
    3. On the main form page, click the Form Properties button.
    4. In Events > Form Libraries click the Add button to add your Web Resource.
    5. In Events > Event Handlers select the Form control and OnLoad event and click the Add button.
    6. Fill in the following fields:
      1. Function: setDirectUrlField
      2. Enabled: Checked
      3. Pass execution context: Unchecked
      4. Parameter list: "new_direct_url" (your custom field name)
    7. Save all your changes, and publish the form.

    CRM Screenshot Direct URL Field

    That's it! Now, when working with a entity record in CRM, the Direct URL field will be populated with a full clickable link to the specific record. You can use this field in workflows, etc. by accessing it just like any other form field. If you want the link to be auto-generated in an email, be sure to put a space after the field reference, and the email will automatically display it as a clickable link.

    Don't forget to regenerate your strongly typed code file if you want to use the new custom field in your CRM custom developed extensions! Need more help with CRM? eImagine is a Microsoft Partner with a Silver competency in CRM, and an expert at providing custom CRM optimization and development. Learn about eImagine's CRM services.

    [direct_url_resource.js]

    // Set a form field to the direct URL for a specific entity guid
    function setDirectUrlField(fieldName)
    {
       formEntityTypeCode = crmForm.ObjectTypeCode;
       entityGuid = Xrm.Page.data.entity.getId();
       url = "https://<your server>/main.aspx?etc=" + formEntityTypeCode + "&id=" + entityGuid + "&pagetype=entityrecord";
       nameField = Xrm.Page.data.entity.attributes.get(fieldName);
       if (nameField.getValue() != url)
          nameField.setValue(url);
    }

    Full story

    Comments (1)

  • OMG Software Developer Jokes!

    Math Joke

    Two bytes meet. The first byte asks, “Are you ill?” 
    The second byte replies, “No, just feeling a bit off.”

     

    Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
    “Yeah,” reply the bytes. “Make us a double.”  

     

    What did the Java code say to the C code?
    You’ve got no class. 

     

    Why do programmers always get Christmas and Halloween mixed up?
    Because DEC 25 = OCT 31 

     

    BASIC programmers never die, they GOSUB and don't RETURN.  

     

    In order to understand recursion, one must first understand recursion. 

     

    There are 10 types of people in this world.
    Those who understand binary, and those who don't. 

     

    Why are non-.NET programmers always so frustrated?
    Because their code is simply unmanagable! 

     

    Ok, I admit it--I wrote that last one! 

     

     

    // TO DO: Find more programming jokes to add...

    Full story

    Comments (0)

  • Custom Development: Microsoft Dynamics CRM 2011 > Microsoft Dynamics CRM 4.0

    Microsoft Dynamics CRM 4.0 vs. 2011

    By now, pretty much everyone is aware of the user-focused benefits of moving to Microsoft Dynamics CRM 2011. The improvements are vast and getting great reviews and feedback from users who have upgraded successfully. However, I wanted to take a moment to address the benefits from a development side. Having developed and upgraded several custom applications for Microsoft Dynamics CRM 2011 lately, I want to praise Microsoft for making great improvements in the development experience. It is much, much easier to develop custom apps and plugins due to some of the new or improved features:

    • Ease of programming due to generating a strongly-typed code file. This does half the work for me, modeling all my custom CRM elements for developer interaction. Love it!
    • The new programming model for WCF. This makes developing custom apps even more rapid than before.
    • Extended use of Workflow Processes! Finally, easy customizaton for workflows and workflow actions.
    • REST implementation for Ajax processing of CRM actions. This allows for some slick user interfaces in custom apps.
    • LINQ support. Again, goodbye cumbersome query writing!!! Did I mention I hated the horrible queries I had to write for CRM 4?

    Thinking about upgrading your custom apps or plugins as you upgrade from CRM 3.0 or 4.0 to 2011? eImagine is a seasoned CRM 2011 upgrade pro! We'd love to help you out, with full support from infrastructure planning to custom development.

    Check out the previous article on User Features: Microsoft Dynamics CRM 2011 > Microsoft Dynamics CRM 4.0

    Full story

    Comments (0)

  • User Features: Microsoft Dynamics CRM 2011 > Microsoft Dynamics CRM 4.0

    Microsoft Dynamics CRM 2011 is greater than Microsoft Dynamics CRM 4.0

    Microsoft Dynamics CRM 2011 is a great leap forward for the Dynamics family of products. Microsoft really focused on an improved user experience. Things are easier to do in less clicks, and the whole look and feel of CRM is improved, in my opinion. CRM 4.0 had a lot of lacking features, and it appears that Microsoft kept up reading the forums of people's wants and needs, and brought almost all of those to life in CRM 2011.

    Here are some of my favorite new or enhanced features:

    • Dashboards - Exciting, rich, interactive dashboards out of the box are probably the best new feature of CRM 2011. It's simply to create and customize personal and organization-wide dashboards with charts, graphs, lists, and more. You can also bring up graphs and charts from practically any view on the right sidebar for a quick visualization. Prior to 2011, many customers had 3rd party plugins or custom development to enable dashboard-type functionality. Now, that can all be eliminated with this new feature.
    • Microsoft Office-style Ribbon - CRM now has a Office-style ribbon to match the other Office applications. Best of all, the ribbon is fully contextual, which means it changes dynamically based on the focus in the form. This allows you to have quick access to common features and actions based on the item you are working in, instead of just the generic entity or form actions.
    • Default Views - CRM 4.0 had system-wide default views that were set for all users. CRM 2011 finally allows users to set their own default views! Why wasn't this always a feature?!
    • Column Filtering - CRM 2011 has a quick action available for all views to filter by column. This eliminating the cumbersome action of going to Advance Find to filter your results when necessary.
    • Import/Export - Data import and export is greatly expanded in 2011 to a number of different file formats (CSV, TXT, XML, etc.) which makes it easier to save and recreate records in bulk. I also like to use it to "copy" records by exporting, editing, and reimporting them. This is great for entities that do not allow duplication or creation of a new record based on an existing one.
    • Session Stickyness - A number of items are now session-aware... That is, if you are looking at a custom view of an entity and navigate away, when you come back it will load that last used view. This is yet another "why wasn't it already there?" type improvement that saves time and effort.
    • SharePoint Integration - If you have Microsoft Dynamics CRM, you probably have SharePoint also. CRM 2011 allows you to map SharePoint libraries to entities like Opportunities, so you can leverage the document library and workspace functionality of SharePoint in tandem with CRM. This is a great way to stay completely organized and far superior to the limited file attachment options in CRM 4.0.

    And those are just a few a my favorite features from being a daily (hourly?) CRM user who went from a 4.0 implementation to 2011. eImagine is a Microsoft Dynamics CRM optimization expert. Whether you have 4.0 or 2011, we can help you utilize the best of the features available to keep your business running smoothly and efficiently!

    Check out this follow-up blog post on the great new developer features in Microsoft Dynamics CRM 2011!

    Full story

    Comments (0)

  1. 1
  2. 2
  3. 3
  4. 4
  5. Next page