【发布时间】:2013-01-04 00:08:43
【问题描述】:
我正在通过 Java 应用程序进行 Dynamics CRM 集成,并且我已经按照 CRM 培训工具包中的示例进行了操作,并成功地连接并创建了客户和联系人。 现在,在创建帐户以及将联系人与帐户连接时,我遇到了一些问题。 例如,我无法使用作为选项列表的“address1_freighttermscode”创建帐户。 我的代码如下:
private static OrganizationServiceStub.Guid createAccount(OrganizationServiceStub serviceStub, String[] args) {
try {
OrganizationServiceStub.Create entry = new OrganizationServiceStub.Create();
OrganizationServiceStub.Entity newEntryInfo = new OrganizationServiceStub.Entity();
OrganizationServiceStub.AttributeCollection collection = new OrganizationServiceStub.AttributeCollection();
if (! (args[0].equals("null") )) {
OrganizationServiceStub.KeyValuePairOfstringanyType values = new OrganizationServiceStub.KeyValuePairOfstringanyType();
values.setKey("name");
values.setValue(args[0]);
collection.addKeyValuePairOfstringanyType(values);
}
if (! (args[13].equals("null"))){
OrganizationServiceStub.KeyValuePairOfstringanyType incoterm = new OrganizationServiceStub.KeyValuePairOfstringanyType();
incoterm.setKey("address1_freighttermscode");
incoterm.setValue(args[13]);
collection.addKeyValuePairOfstringanyType(incoterm);
}
newEntryInfo.setAttributes(collection);
newEntryInfo.setLogicalName("account");
entry.setEntity(newEntryInfo);
OrganizationServiceStub.CreateResponse createResponse = serviceStub.create(entry);
OrganizationServiceStub.Guid createResultGuid = createResponse.getCreateResult();
System.out.println("New Account GUID: " + createResultGuid.getGuid());
return createResultGuid;
} catch (IOrganizationService_Create_OrganizationServiceFaultFault_FaultMessage e) {
logger.error(e.getMessage());
} catch (RemoteException e) {
logger.error(e.getMessage());
}
return null;
}
当它执行时,我得到这个错误
[ERROR] Incorrect attribute value type System.String
有人有关于如何处理选项列表或查找的示例吗?
为了将联系人与帐户联系起来,我使用来自帐户的 GUID 和“帐户”填充字段 parentcustomerid 和 parentcustomeridtype,但联系人没有与帐户关联。
【问题讨论】:
-
请问您为什么要从 Java 中执行此操作?我能想到几个原因,但我想知道你的具体原因。
-
您的答案得到答复了吗?如果是这样,请检查回复作为答案。否则,请告诉您还需要什么。
-
嗨康拉德,我仍然没有答案。我是从 java 中这样做的,因为我是从 oracle 存储过程中调用的,这就是我从那里调用 web 服务的方式。
-
我虽然是这样的情况。好吧,我在下面给你一个答案,不知道你是否看过。如果您需要更多帮助,请在其中添加评论(以保持线程的结构)。