2013-01-24 30 views
0

有誰知道Java中的等效代碼來填充類型所有者的屬性嗎?從java中設置Microsoft Dynamics CRM類型所有者的屬性

Owner owner = new Owner(); 
owner.type = EntityName.systemuser.ToString(); 
owner.Value = user.UserId; 

我已經使用了一個entityreference的所有者,並解決了空Guid的問題。但現在我打:

[ERROR] Invalid ownerIdType = 7 

我認爲這是對owneridtype屬性,在上面的C#是第二行相關,米當前的代碼如下:

OrganizationServiceStub.KeyValuePairOfstringanyType owneridtype = new OrganizationServiceStub.KeyValuePairOfstringanyType(); 
owneridtype.setKey("owneridtype"); 
OrganizationServiceStub.OptionSetValue owner2 = new OrganizationServiceStub.OptionSetValue(); 
owner2.setValue(Integer.parseInt("8")); 
owneridtype.setValue(owner2); 
collection.addKeyValuePairOfstringanyType(owneridtype); 

OrganizationServiceStub.KeyValuePairOfstringanyType vendedor = new OrganizationServiceStub.KeyValuePairOfstringanyType(); 
vendedor.setKey("ownerid"); 
OrganizationServiceStub.Guid vendedorGuid = utils.readVendCrm(serviceStub,args[17]); 
OrganizationServiceStub.EntityReference owner = new OrganizationServiceStub.EntityReference(); 
owner.setLogicalName("owner"); 
owner.setId(vendedorGuid); 
vendedor.setValue(owner); 
collection.addKeyValuePairOfstringanyType(vendedor); 
+0

java or javascript? –

+0

Java,它是一個使用soap web服務的外部應用程序,而不是CRM內部的解決方案 –

回答

0

我不瞭解了很多關於Java和CRM 2011的知識,但恐怕這篇文章可能會有用。

Write Java and other Non-.NET Client Applications for Microsoft Dynamics CRM

而且相關的問題:

+0

Thx,這是我第一個用來啓動界面開發的文檔。這很好,因爲它有助於如何連接和使用web服務。它缺少從wsdl2java生成的所有類中的詳細信息,這是我在將C#示例代碼轉換爲JAVA時遇到的問題。 –

0

,它應該被引用正確的實體是不systemuser老闆,那是我的錯誤。 正確的代碼是:

OrganizationServiceStub.KeyValuePairOfstringanyType vendedor = new OrganizationServiceStub.KeyValuePairOfstringanyType(); 
    vendedor.setKey("ownerid"); 
    OrganizationServiceStub.Guid vendedorGuid = utils.readVendCrm(serviceStub,args[17]); 
    OrganizationServiceStub.EntityReference owner = new OrganizationServiceStub.EntityReference(); 
    owner.setLogicalName("systemuser"); 
    owner.setId(vendedorGuid); 
    vendedor.setValue(owner); 
    collection.addKeyValuePairOfstringanyType(vendedor); 
相關問題