Readonly Fields and The Dynamics CRM Workflow Editor

I ran across an issue this week creating a workflow for an entity that had fields set to read-only.

If you’ve never run across this before, setting the Read Only property on a field will not only restrict the modification of field data to the user, but also when working with the CRM workflow editor.

There are several ways around this type of problem:

Option 1: JavaScript

The first option you have is to use JavaScript to set the fields in question to disabled, using the Form Type to determine when that piece of code should work.

While this works, there is now an extra piece of code that must be maintained by someone.

Option 2: Manually change the fields

The second option is for you to remove the read only property from the fields, publish the entity, create your workflow, then reverse the process and make the fields again read only.

While this works, it is a serious pain in the neck and not very maintainable, should you need to make frequent changes.

Option 3: Business rule

I have not tried this option, but I think it is possible, but I don’t have direct knowledge of the interaction between the business rules and the workflow editor.

Another topic for a future blog.

Option 4: Administration Form

This is, by far, the most elegant solution I think, and the one I chose to implement:

Tip #265: Administrator updates of read-only fields

January’s Free Dynamics CRM Webinars

Hi Everyone,

I am moving my free webinar series from Tuesday to Fridays so instead of Teaching on Tuesdays, we’ll have Free Webinar Fridays.

Here are this month’s webinars:

Dynamics CRM 2016 New Features

In this webinar we'll review the new features that are part of Dynamics CRM 2016

Friday, January 22nd. 10:00am (Central Time US)  Register Here

Dynamics CRM Security 101

In this webinar we'll discuss the basics of Dynamics CRM security including security roles, business units, and teams.

Friday, January 29th. 10:00am (Central Time US)  Register Here

 

I have more webinars planned but if any topic sticks out that you’d like to have covered, then please let me know.

Thanks, Mitch

Transformer! 3.0 is available. Convert your CRM 4.0 JavaScript to 2011+ in minutes

Version 3.0 of Transformer! for Dynamics CRM is now available.

The main addition to this version is the ability to read Dynamics CRM 2011+ solution files.

In addition, the following conversions were added:

crmForm.all.name.DataValue = crmForm.all.ownerid.InnerText;

Converts to:

Xrm.Page.getAttribute("name").setValue(Xrm.Page.getAttribute("ownerid").getValue()[0].name);


if (crmForm.all.new_location.InnerText != "Pool") {

Converts to:

if (Xrm.Page.getAttribute("new_location")[0].name != "Pool") {


var tab = document.getElementById('tab' + tabnumber + 'Tab');

Converts to:

var tab = Xrm.Page.ui.tabs.get(tabnumber);

About Transformer! for Dynamics CRM

Transformer! converts your Dynamics CRM JavaScript from the version 4.0 object model to the Xrm.Page (2011+) object model.  It can save you literally hundreds of hours of developer time when upgrading to Dynamics CRM 2015 or 2016.

If you did not know, Dynamics CRM 2013 introduced an environmental check that requires you just have all references to the CRM 4.0 object model removed before you can upgrade the organization.

Transformer! converts absolutely everything and anything that can be converted to the Xrm.Page model – including the unsupported customizations that all of us once used to produce a dynamic user experience.

What does not get automatically converted must be converted manually.

Visit the Transformer! product page for more information, download the trial, and review the documentation.

If you have any questions, then please let me know.

Upcoming Workshop: Dynamics CRM Management and Troubleshooting (On Premises)

Hi Everyone,

It has been a while since I held this webinar so I thought I’d do so again.

Overview

This webinar is for administrators of Dynamics CRM On Premises and will cover the following topics:

  • Review of the tools that you need to have in your toolbox
  • Error, Warning, and Notification Messages
  • Managing System Jobs
  • Automating System Job Clean-up
  • User Management Tips and Tricks
  • Email Management
  • Database Clean-up
  • Monitoring the Windows Event Log
  • Platform Event Tracing
  • Troubleshooting Using Event Tracing
  • Workflow Best Practices
  • CRM SQL System Jobs

Note:   Due to the nature of some of the material, this will be for Dynamics CRM On Premise customers only. We will conduct a separate seminar for Dynamics CRM Online customers at a later time.  If  you are interested in attending that seminar, please contact me.

The information covered is relevant to Dynamics CRM versions 2011+, with any version-specific information noted.

When:

Wednesday, January 27th, 2016 at 1:00pm (Central Time-US)

Class Duration:

2.5 hours

Cost Per Attendee:

$199USD

Eventbrite - Dynamics CRM Management and Troubleshooting (On Premises)

Note:  Due to the interactive nature of this webinar, this session is limited to 25 attendees.

Bonuses:

Each attendee will receive a copy of my upcoming book: Dynamics CRM Deep Dive: Administration.

Drop me a line if you have any questions.

Thanks, Mitch

More Azure ADAL error handling

Back in October I published a post titled: How to capture moble login errors with Azure ADAL. Here is an additional piece to add to that article.

Background

I am working on a Xamarin Forms app that uses Azure Active Directory for authentication. If you’re not familiar with this process, it uses the OAuth protocol to verify the identity of the user. This process is actually handled outside of the application with a authentication token returned to the application in the case of a successful login, or an error, in the case of a failure.

Last week I ran into something that was neither of those:

Loginerror

The information displayed above is actually a web page, and as mentioned above, actually outside of the application, so in effect, the application does not, nor will not, know of the error because it is not actually being reported back as an authentication failure.

Possible Causes

First and foremost, the error statement is not 100% correct.  My user did indeed have the proper access to the tenant, so I knew that was not the problem.

In all likelihood, this was an issue that was cause by either incorrectly cached credentials, or a change in the configuration of the application within Azure Active Directory.

Correcting the Issue

While I have code that will clear any cached credentials, I was not actually logged into the application where the logout button could be pressed and the code executed. That left me with the only  other possibility: Removing the application from the device.

I did so, then redeployed, and everything was fine.

Lessons Learned?

While I am not positive which of the two scenarios it might have been, we might need to add a mechanism on the login screen to clear cached credentials so that the issue doesn’t reoccur.  But it may not actually be an issue that will be seen in the real world so we will probably just take a wait and see attitude.

End of Year Sale on All Dynamics CRM Utilities

Hi Everyone,

The Dynamics CRM community has been really good to me this year and I thought that I would give everyone who doesn’t already own one of my Dynamics CRM administration or development utilities a chance to purchase one at a discount.

The discount expires at Midnight (Central Daylight Time) on January 1st.

So what utilities do you have?

Here is  a quick review of my Dynamics CRM utility portfolio:

SnapShot!

SnapShot! is the ultimate documentation tool for Dynamics CRM. In face, the only way you can extract most of the information provided in SnapShot!’s reports, is to write a custom application to do so.  We’ve already done this, so let us save you the time and trouble.

Explorer!

Explorer! allows you to review the contents of your Dynamics CRM system to verify:

  • Do I really show my users the data they need to see?
  • Do I have fields in the database not being used and just taking up disk space?
  • Are my forms properly designed, showing the most important information first?
  • Identify Custom Entities that contain little or no data.
  • Find Entities with a higher proportion of disabled records to enabled records.

Transformer!

Transformer! converts your Dynamics CRM JavaScript from the CRM 4.0 object model to the Xrm.Page object model (CRM 2011 and above).  This can save you hundreds, possibly thousands, of hours in converting your JavaScript between the two models. Absolutely anything and everything that could be converted, is converted. What remains must be converted manually. Regardless, it is the fastest way to get into a supported state with your Dynamics CRM JavaScript.

Get the Discount

Use discount code: EOY2015 when you check out.  Remember, the discount expires at Midnight (Central Daylight Time) on January 1st.

 

If you have any questions, please free to contact me.

Thank for you so much for the support over the past year and I would like to wish you a happy and safe New Years holiday.

Thanks, Mitch

Dynamics CRM Code Snippet: Get Maximum Attachment Size Limit

If you are ever working with any code that needs to upload attachments to Dynamics CRM, you may run into an issue where your attachment is larger than the default of 5MB.

To prevent errors from occurring, you can check the Organizational Setting for the maximum upload file size, using code like this:

public int GetAttachmentSizeLimit()
{
    var size = -1;

    var query = new QueryExpression("organization")
    {
        ColumnSet = new ColumnSet("maxuploadfilesize")
    };

    var results = _proxy.RetrieveMultiple(query);

    if (results.Entities.Count == 0)
    {
        return size;
    }

    return results[0].GetAttributeValue<int>("maxuploadfilesize");
}

Depending on how you are uploading the attachment, you can either present the user with a warning (if uploading a single attachment), or ignore the attachment and add it to an exception report if running in a batch operation.

This setting can be found under Settings, Administration, System Settings, on the Email tab:

system settings - file upload size

Dynamics CRM 2015: Invalid Argument error encountered while merging records

This morning one of my customers ran into this error while merging two Accounts:

clip_image001

Not very descriptive and since the normal Download Log File button was disabled, also not a lot of help.

I turned on platform tracing and repeated the merge process so that I could hopefully capture the real error.  Here is what showed up (in order of appearance):

Web Service Plug-in failed in SdkMessageProcessingStepId: {27CBBB1B-EA3E-DB11-86A7-000A3A5473E8}; EntityName: none; Stage: 30; MessageName: InitializeFrom; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin;


MessageProcessor fail to process message 'InitializeFrom' for 'none'.


Error: There is no entity map defined for the given entities
Error Number: 0x80040E01
Error Message: There is no entity map defined for the given entities
Error Details: There is no entity map defined for the given entities
Source File: Not available
Line Number: Not available
Request URL:
Stack Trace Info: [CrmException: There is no entity map defined for the given entities]
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.InitializeFromCommand.Execute()


Error: The role is invalid for this entity combination.
Error Number: 0x80040203
Error Message: The role is invalid for this entity combination.
Error Details: The role is invalid for this entity combination.
Source File: Not available
Line Number: Not available


It was, of course, the final exception that was the key.

It turns out that both Account had Relationship Roles associated with them and I am assuming that the two sets of roles were incompatible with each other.

I removed the roles from the second Account and the merge was correctly performed.

Sharing information and lessons learned with other developers

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