Last updated: 2006
Entity Type | Notes |
Custom | New entities types. Can be deleted |
System (Customizable) | Existing entity types that support limited customization allowed. Cannot be deleted. |
System (Non-customizable) | Existing entity types that cannot be customized or deleted. Cannot add form or views. |
Attribute | Notes |
Display Name | UI text |
Schema Name | SQL column name (aka 'metadata scheme name'). Schema name cannot be changed after creation. Default schema prefix can
be set up in Settings\Organization Settings. Note: While the schema name is lowered in CRM, it's propered in the database. |
Requirement Level |
|
Type |
SQL Data Type (nvarchar, int, ntext, datetime, bit, float,
money) plus:
|
Format | Dependent on Type. For example, varchar supports:
E-mail, Text, Text area (multiline text box), URL and Ticker symbol. |
Maximum Length / List Value / Default Value / Minimum Value / Maximum Value / Precision |
As they sound. Only options relevant to the selected datatype are displayed. |
Description | Help text for Sys Admins. Not visible to end users. |
Access Level | Notes |
None | Deny |
User | |
Business Unit | |
Parent : Child | |
Organizational | Superuser |
Retrieve Sample |
ColumnSet columnSet =
new
ColumnSet(); |
Execute Sample |
whoAmIResponse whoAmIResponse = (WhoAmIResponse) service.Execute(new WhoAmIRequest()); Console.WriteLine(whoAmIResponse.UserId); |
RetrieveMultiple Sample |
QueryExpression queryExpression = new QueryExpression();queryExpression.EntityName = EntityName.new_davetest.ToString(); // Only requested fields are returned (rest will be null) ColumnSet columnSet = new ColumnSet(); columnSet.Attributes = new string[] { "new_davetestid", "new_name", "createdby", "modifiedon" }; queryExpression.ColumnSet = columnSet; // Create a filter condition FilterExpression filterExpression = new FilterExpression(); filterExpression.FilterOperator = LogicalOperator.And; ConditionExpression conditionExpression = new ConditionExpression(); conditionExpression.AttributeName = "modifiedon"; conditionExpression.Operator = ConditionOperator.ThisYear; filterExpression.Conditions = new ConditionExpression[] { conditionExpression }; queryExpression.Criteria = filterExpression; // Set the order OrderExpression orderExpression = new OrderExpression(); orderExpression.AttributeName = "new_name"; orderExpression.OrderType = OrderType.Ascending; queryExpression.Orders = new OrderExpression[] { orderExpression }; // Do it BusinessEntityCollection bec = service.RetrieveMultiple(queryExpression); // Show some output foreach (new_davetest davetest in bec.BusinessEntities) { Console.WriteLine("Name: {0}", davetest.new_name); } |
FilteredView Example |
SqlConnection connection = new SqlConnection("Data Source=mbssbpcorpsql;Initial Catalog=Payroll_Live_MSCRM;Integrated Security=SSPI");SqlDataAdapter adapter = new SqlDataAdapter();adapter.SelectCommand = new SqlCommand("SELECT * FROM FilteredPayroll_Employee", connection);DataTable table = new DataTable();adapter.Fill(table); Console .WriteLine("{0} rows returned", table.Rows.Count);if (table.Rows.Count > 0){
} }
|
Event | Notes |
pre/postCreate | Record creation |
pre/postUpdate | Record update |
pre/postDelete | Record delete |
pre/postAssign | Record ownership changed |
pre/postSetState | ?? TODO |
pre/PostMerge | ?? TODO |
preSend | Prior to sending an e-mail |
postDeliver | After sending an e-mail |
Sample hook (XML side) |
<? xml version="1.0" encoding="utf-8" ?>< callout.config version="2.0" xmlns="http://schemas.microsoft.com/crm/2006/callout/"><callout entity="new_myEntity" event="PostUpdate"> <subscription assembly="MyAssembly.dll" class="MyCallouts.MyPostUpdateAccountClass"> <prevalue>name</prevalue>
< callout entity="payroll_davetest" event="PreUpdate">< subscription assembly="DaveTest.dll" class="DaveTest.DaveCallout" /></ callout></ callout.config> |
Sample hook (.NET side) |
using System;using System.IO;using System.Xml;using System.Xml.Serialization;using Microsoft.Crm.Callout;using DaveTest.CrmSdk;namespace DaveTest{ public class DaveCallout : CrmCalloutBase{ public DaveCallout(){ } public override PreCalloutReturnValue PreUpdate(CalloutUserContext userContext, CalloutEntityContext entityContext, ref string entityXml, ref string errorMessage) { XmlRootAttribute root = new XmlRootAttribute("BusinessEntity");root.Namespace = "http://schemas.microsoft.com/crm/2006/WebServices"; XmlSerializer xmlSerializer = new XmlSerializer(typeof(BusinessEntity), root); StringReader sr = new StringReader(entityXml); BusinessEntity entity = (BusinessEntity)xmlSerializer.Deserialize(sr); DynamicEntity dynamicEntity = entity as DynamicEntity; if (dynamicEntity != null){ errorMessage = String.Format("Entity fields were: \n\tpayroll_name={0}\n\tpayroll_myfield1={1}\n\tpayroll_myfield2={2}",GetStringPropertyValue(dynamicEntity.Properties, "payroll_name"),GetStringPropertyValue(dynamicEntity.Properties, "payroll_myfield1"),GetStringPropertyValue(dynamicEntity.Properties, "payroll_myfield2"));} else{ errorMessage = "Failed to de-serialize";} return PreCalloutReturnValue.Abort;} private static string GetStringPropertyValue(Property[] properties, string propertyName) { Property property = FindProperty(properties, propertyName); if (property == null) return null; StringProperty stringProperty = property as StringProperty; if (stringProperty == null) return null; return stringProperty.Value;} private static Property FindProperty(Property[] properties, string propertyName) { foreach (Property property in properties){ if (property.Name == propertyName) return property;} return null;} } } |
Note: The entityXml parameter is a a diffgram. If the attribute hasn't changed in the form, its value isn't included in the diffgram and therefore ends up as null in the above example.
Setting | Value |
Enabled HTTP Keep-Alives | On |
Application name | Microsoft CRM |
Execute permissions | Scripts only |
Application Pool | CRMAppPool |
Content expiration | 3 days |
Custom HTTP header | [p3p privacy policy] |
Authentication Method | Integrated Windows authentication (The Outlook client requires automatic login (e.g. server to be in a trusted zone). While the CRM client doesn't require this, adding it to the trusted zone is the way average user avoid manual sign ins and popup permissions) |
SSL cert | Not required |
Edition | Notes |
Core | Accounts, Contacts, Security, Calendar, Reporting, Extensibility |
Standard | Leads, Outlook Client, Correspondence, Mail Merge |
Professional | Quotes, Product Catalog, Workflow, GP integration |
Key | Type | Value |
TraceEnabled | DWORD | 1 |
TraceDirectory | string | [Full path to an existing directory] |
TraceCallStack | DWORD | 0 |
TraceRefresh | DWORD | 1 |
TraceSchedule | string | Hourly |