0

有谁知道Java中的等效代码来填写类型所有者的属性?

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

我使用了对所有者的实体引用并解决了空 Guid 的问题。但现在我要打了:

[ERROR] Invalid ownerIdType = 7

我认为这与上面C#中第二行的owneridtype属性有关,m当前代码如下:

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);  
4

2 回答 2

0

恐怕我对 Java 和 CRM 2011 了解不多,但这篇文章可能会有用。

为 Microsoft Dynamics CRM 编写 Java 和其他非 .NET 客户端应用程序

还有相关问题:

于 2013-01-25T10:06:53.530 回答
0

应该引用它的正确实体是系统用户而不是所有者,这是我的错误。正确的代码是:

    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);  
于 2013-01-29T16:40:49.313 回答