Bootstrap

CRM中服务器端的开发

1 CRM 服务端技术要求

 -  使用server-side SDK所需的技术

       - IIS

       - C# / VB.NET

       - SQL (For Filtered Views and reporting only)

       - ASP.NET WebWeb  Forms

       - XML / XML HTTP (AJAX)

       - Web Services

      

2、新实体-重点

-  report - Reports 可以马上创建连接到另外的实体

 -  isvconfig -  ISV Config.Config文件是一个可以通过sdk创建和更新 的实体

 -  duplicaterule - 重复检测规则可以编程创建和更新

 -  organizationui - 可以容易的存取一个组织的 窗体XML, 属性XML, 视图XML, 等等.

 - bulkdelete -允许基于查询语句异步删除许多实体实例

 

3、基础- 数据类型

CrmBoolean

CrmReference

EntityNameReference

CrmDecimal

Key

CrmFloat

Lookup

CrmMoney

Owner

CrmNumber

Picklist

Customer

UniqueIdentifier

Status

CrmDateTime

 

 

 

4、基础- 操作

-创建

// Assuming you already have a configured CrmService class

// named service

// Create an account entity and assign data to some attributes.

account newAccount = new account();

newAccount.name = "Greg Bike Store";

newAccount.address1_postalcode = "98052";

newAccount.address1_city = "Redmond";

// Call the Create method to create an account.

Guid accountId = service.Create(newAccount);

 

 -检索

 

// Assuming you already have a configured CrmService class

// named service

Guid id = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

// Call the Retrieve method to retrieve an existing contact.

ColumnSet cols = new ColumnSet();

cols.Attributes = new string[] { "firstname" };

contact cont =

(contact)service.Retrieve(EntityName.contact.ToString(),id,cols);

 

 

 -更新

// Assuming you already have a configured CrmService class

// named service

// Create the contact object.

contact cont = new contact();

// Set the contact object properties to be updated. cont.address1_line1 ="34 Market St.";

// The contactid is the ID of the contact to be updated.

cont.contactid = new Key();

// The contactid.Value is the GUID of the record to be changed.

cont.contactid.Value = new Guid("4D507FFE-ED25-447B-80DE-00AE3EB18B84");

// Update the contact.

service.Update(cont);

 

 -删除

 

// Assuming you already have a configured CrmService class

// named service

Guid id = new Guid("2B951FBC-1C56-4430-B23B-20A1349068F3");

// Delete the contact

service.Delete(EntityName.contact.ToString(), id);

 

5Dynamic Entity

 -  CRM 3.0以后没有改变

 -  新的 DLL助手提供基于字符串的索引器

 -  Dynamic Entity 许可ISVs 通过实体和键/值对应的属性来工作.在设计时使得编码依赖模型和实体.

 -  Workflow / Plug-ins 使用 Dynamic Entities 描述实体的关系

 -  即使实体不是强类型,属性仍然是强类型.

 

6、过滤视图(Filtered Views

 -  用户不能存取标准的SQL视图记录.

 -  必须使用AD验证,不能再SQL验证下工作.

 -  CRM 3.0没有太大变化。

 -  实体的结构发生变化时过滤试图自动更新(re-generated).

 -  特殊组织.

 -  更新包括新的列用于多货币和多语言的支持

7、其它方法

 -  所有,创建更新和删除都通过工作

 -  创建,更新,删除,索引只是调用Execute 请求的快捷方式.

 -  Execute 是请求/响应的模式,每个操作包括两种,一个是请求一个是相应的响应

     例如:RetrieveRequest RetrieveResponse

例如:

// Create the request object.

AddItemCampaignRequest addReq = new AddItemCampaignRequest();

// Set the properties of the request object.

addReq.CampaignId = campaignId;

addReq.EntityId = productId;

addReq.EntityName = EntityName.product;

// Execute the request.

AddItemCampaignResponse addRes = (AddItemCampaignResponse)

service.Execute(addReq);

// Get the ID of the new Campaign

Guid id = addRes.CampaignItemId;

 

8、验证– AD Form

AD验证

// Get the CRM Users appointments Setup the Authentication Token

CrmAuthenticationToken token = new CrmAuthenticationToken();

token.OrganizationName = My Org;

CrmService crmService = new CrmService();

crmService.Credentials = CredentialCache.DefaultCredentials;

crmService.CrmAuthenticationTokenValue = token;

 

;