2011-06-13 88 views
0

我開發了CMS給我的一個客戶,他希望當用戶填寫聯繫表時,它會自動生成他的CRM中的鉛。 這樣做最簡單的方法是什麼?Microsoft Dynamics CRM 2011:如何從外部聯繫表格生成鉛

順便說一句,聯繫表格是ajax,數據被轉移到asmx,所以很容易打電話給CRM webservice或類似的東西,因爲我已經在服務器端。

有人可以指點我的教程或一些代碼示例嗎? 謝謝!

回答

4

你最好開始將與現有的here SDK,其中包含示例代碼和SDK的DLL等..

Here是一個快速參考,所有的Web服務端點在不同的口味提供一個頁面CRM 2011

從SDK samplepcode \ CS \快速啓動的創建帳戶,但對鉛非常相似:

  // Connect to the Organization service. 
      // The using statement assures that the service proxy will be properly disposed. 
      using (_serviceProxy = new OrganizationServiceProxy(serverConfig.OrganizationUri, 
                   serverConfig.HomeRealmUri, 
                   serverConfig.Credentials, 
                   serverConfig.DeviceCredentials)) 
      { 
       // This statement is required to enable early-bound type support. 
       _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior()); 

       // Instaniate an account object. 
       // See the Entity Metadata topic in the SDK documentation to determine 
       // which attributes must be set for each entity. 
       Account account = new Account { Name = "Fourth Coffee" }; 

       // Create an account record named Fourth Coffee. 
       _accountId = _serviceProxy.Create(account); 
       Console.Write("{0} {1} created, ", account.LogicalName, account.Name); 

       // Retrieve the account containing several of its attributes. 
       ColumnSet cols = new ColumnSet(
        new String[] { "name", "address1_postalcode", "lastusedincampaign" }); 

       Account retrievedAccount = (Account)_serviceProxy.Retrieve("account", _accountId, cols); 
       Console.Write("retrieved, "); 

       // Update the postal code attribute. 
       retrievedAccount.Address1_PostalCode = "98052"; 

       // The address 2 postal code was set accidentally, so set it to null. 
       retrievedAccount.Address2_PostalCode = null; 

       // Shows use of a Money value. 
       retrievedAccount.Revenue = new Money(5000000); 

       // Shows use of a boolean value. 
       retrievedAccount.CreditOnHold = false; 

       // Update the account record. 
       _serviceProxy.Update(retrievedAccount); 
       Console.WriteLine("and updated."); 
+0

謝謝,我開始讀的SDK,我想也許有人之前也做了同樣的任務(我想很多p人們需要這種功能),並可以共享一些代碼或一些教程。 – eran 2011-06-13 23:35:14

+0

用SDK – csjohnst 2011-06-14 03:38:03

+0

中提供的一些特定代碼示例更新了答案,謝謝,這真的有所幫助。 – eran 2011-06-14 08:11:40

相關問題