Following on from my last post I wanted to share some of the tips I’ve picked up along the way related to developing new entities in Dynamics CRM/365.
The first major step in any development is the creation of a new system entity, and there are plenty of opportunities for missteps here.
Per my last post, ensure any new Entity is created from within a solution, and NOT by selecting “Customize the System”!
The initial decision you need to make is to decide whether you need the Entity to be owned by a User or Team, or by the Organization. This decision can be influenced by the following factors:
- Does the entity need specific security, or will it be open to all Users?
- Do you need to have a specific named Owner of the records in the Entity?
- Is the entity going to be used for a reference record (e.g. preferred language, region, etc.)?
This decision cannot be changed after the entity is created, so it is important to make the right decision. If you’re not sure, I’d always recommend selecting User or Team ownership, as you can work around this to emulate Organizational ownership, this isn’t possible the other way around.
For more reading, see this article on MSDN.
The next decision you need to make is whether the entity is an Activity or not. This is a fairly straightforward decision
If the records will have a Start Time and/or an End Time, and will be Completed by Users, then it is probably an Activity.
It’s important to remember that defining an Entity as an Activity Entity cannot be undone, and that Activity Entities don’t have security, all Users can see all Activities, so factor this into your thinking.
A simple mistake I have seen made by many developers is to overlook the Primary Field. It’s on a separate tab, so it’s really easy to click Save and forget about it, only to regret it later.
It’s important to give it a relevant name for your entity. The Primary Field can only be a Single Line of Text field, formatted as Text. Update the Display Name and Name to something relevant for your new entity, also decide if you want the Field to be required or not, and update the Maximum Length. I’d also recommend adding a proper description here.
The Primary Field is used for lookups to the entity, and is the default field included in a View when you create an entity, so forgetting about it can lead to search results that look like:
Even if you’re not going to use the Name (for example if you’re creating a manual intersect entity), I’d always recommend setting it up properly. In situations where I’m not using the Name I will always set up a Workflow or Business Rule to set the Name automatically.
The last thing to decide before you save your new entity is which of the options you want to select. The best advice I can give here is to untick everything, unless you are ABSOLUTELY sure that you need to keep a field ticked. This is particularly important for the Business Process Flow, Feedback, Notes, Activities, Connections, Sending Email, Queues, and Enable for SLA fields, which cannot be disabled once they are selected. You can always enable them later if you need them, but they create fields on your entity, and add to clutter if they’re then unused.
Once you’re happy with all of the entity options, click Save and now you can move on to adding Fields. I’ll share my tips for Fields in my next post.