Dynamic CRM 2013 Learning Notes (iii) Quick Create entity Entitycreater

Source: Internet
Author: User
Tags microsoft dynamics

I. Introduction of Entities

Entities are used to establish business data models and manage business data in Microsoft Dynamics CRM. For example, you can use entities such as customers, campaigns, and events (cases) to track and support sales, marketing, and service activities. An entity has a set of properties, each representing a specific type of data item. For example, the customer entity has the Name, Address, and ownerID attributes. Conceptually, entities are similar to database tables, and entity properties correspond to table columns. Creating an Entity record (or record) in Microsoft Dynamics CRM is similar to adding a record to a database table. Entities are divided into three categories: system, business, and customization. As a developer who processes business data, you will use business and custom entities. Microsoft Dynamics CRM uses system entities to process all internal processes, such as workflows and asynchronous jobs. You cannot delete or customize system entities.

Business entities are part of the default installation of Microsoft Dynamics CRM, and they appear in the custom user interface. For example, accounts, contacts, and letters are business entities. After you install Microsoft Dynamics CRM, you can add custom entities to it to meet your organization's specific business needs. In the Microsoft Dynamics CRM solution, you can set business and custom entities and properties to be customizable or non-customizable. You can modify customizable entities by renaming customizable entities, adding new attributes, or changing various settings, such as duplicate detection or queue support settings. You cannot modify a non-customizable entity.

Ii. Problems in existence

    1. We generally create entities on the CRM system through the interface, but this efficiency is too low, and some properties can not be modified, so sometimes the problem arises: sometimes in order to modify a property of an entity, but this property can not be modified, then we have to delete the entire entity, and then add the field one by one.
    2. If there are many people in the project, although there is a naming specification document, for example, we generally put the lookup type of field after the ID, but sometimes accidentally a brother will forget.

Third, the solution

So I thought about the tool to generate the entity, after searching online, did not find any good entity generation tools. So you have to do it yourself, create entities and attributes of each type:

1. Entity creation

 1:createentityrequest request = new  createentityrequest 
pre> 2: {
 3:hasnotes = false , 
 4:hasactivities = false , 
 5:entity = new  Entitymetad ATA 
 6: {
 7:isactivity = false , 
 8 : SchemaName = customentityname, 
 9:displayname = new  Lab El (Entity. DisplayName, 1033), 
 10:displaycollectionname = new  Label (entity.d Isplayname, 1033), 
 11:ownershiptype = ownershiptypes.userowned, 
 12:isavailable
Offline = true  
:} 
:}; 

2. String property

  1: [AttributeType ("single line ofText")]
   Public class Stringattributeecreater:attributecreater
  3: {
  4: Public     override attributemetadata Create ()
  5:     {
  6:         new Stringattributemetadata
  7:         {
  8:             SchemaName = Field.physicalname,
  9:             requiredlevel = Getrequiredlevel (),
Ten:             MaxLength = 100,
One:             FormatName = Stringformatname.text,
:             New Microsoft.Xrm.Sdk.Label (Field.displayname, 1033)
:         };
:         return attribute;
:     }
16:}
3. OptionSet Properties
  1: [AttributeType (OPTIONSETATTRIBUTEECREATER.OPTIONSET_STR)]
   Public class Optionsetattributeecreater:attributecreater
  3: {
  4: Public     conststring optionset_str = "Option Set";
  5: Public     override attributemetadata Create ()
  6:     {
  7:         new Picklistattributemetadata
  8:         {
  9:             requiredlevel = Getrequiredlevel (),
Ten:             SchemaName = Field.physicalname,
One:             new Microsoft.Xrm.Sdk.Label (Field.displayname, 1033),
:             new optionsetmetadata ()
:         };
:         true;
:         if (!  String. IsNullOrEmpty (Field.remark))
:         {
:             attribute. Optionset.name = Field.remark;
:         }
:         Elseif (!  String. IsNullOrEmpty (Field.typerule))
:         {
:             string[] arr = Field.TypeRule.Split (' \ n ');
:             foreach (string in arr)
:             {
:                 string[] arr2 = Item. Split (', ', ', ');
:                 if (arr2. Length = = 2)
:                 {
:                     intvalueint. Parse (Arr2[0]);
A:                     attribute. OPTIONSET.OPTIONS.ADD ( new Optionmetadata (newvalue));
:                 }
:             }
:         }
:         return attribute;
:     }
36:}
Other properties and so on, here is not introduced, you can view the next SDK, there are detailed introduction.

Iv. Entitycreater Tools

1. List entity names and field names through Excel
 
  
            (ENTITYCREATERGUIDE.XLSX)

Here's an example:

2. For the first time use Entittycreater, to modify the CRMEntityCreater.exe.config inside the connection information

<add name= "name" connectionstring= "url=http://xxxx:5555/xxx/; domain=xxxx; username=xxxx; password=xxx; " />

Run Entitycreater and drag the saved Excel file into the upper-left corner of the box, and it will show all the sheet inside, we can create these entities in turn:

3. Click the middle button on the left Generate phical name, automatically generate phisical name:

4. At this point, you can create an entity by clicking on the creation entities. If you just add a few fields, you can just tick field:

5. After creation, we can save the generated phical name to Excel by saving to Excel, and click View Result to view the log information during the creation process.

Download Entitycreater (extract code AEF0)

Dynamic CRM 2013 Learning Notes Series Rollup

Dynamic CRM 2013 Learning Notes (iii) Quick Create entity Entitycreater

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.