When you create a new entity, one of the fields that is generally left unchanged is the primary field for the entity. It is usually “[publisherprefix]_name”.
This field can be either required or left optional. This value of this field, is what shows up in the entity lookups. The value of this field is usually set automatically using JavaScript, Workflow or Plugin. If the value for this field is left null, it manifests a bug in the realtime workflow.
What is the bug?
If the value of the primary field is null on a parent entity, any child entity can’t use “if condition” on the parent relationship field. It would result in a “KeyNotFound” exception.
Replication steps
- Create an entity that will be the parent entity
- Create an entity that will be the child. Create a relationship to the parent entity
- Make the primary field on the parent entity as optional
- Create a new realtime workflow on the child entity, with a condition statement that refers the parent lookup field in the child entity
- Create a parent record without the name field set
- Create a child record that has the parent lookup set the record created in the previous step. The parent lookup will be displayed as “no name” as the primary field for the parent entity is not set.
- Execute the realtime workflow against the child record in the previous step. A “The given key was not present in the dictionary” exception will be displayed
The issue is happening both in CRM 2015 and CRMOnline on version 8.1.0.362. This issue seems to be only affecting realtime workflows and actions, and not background workflows.
EDIT (24/06/2016): Issue logged on Connect -> https://connect.microsoft.com/site687/feedback/details/2851391/realtime-workflow-action-crash-display-name-if-condition-keynotfoundexception
