【发布时间】:2012-06-19 16:13:13
【问题描述】:
所以我们有一个数据结构“Case”,例如退货案例、退款案例等。其中一个字段是“CaseComments”字段。该字段(在 C# wsdl 生成的代码中)是一个 QueryResult 字段。
我知道要查询 CaseComments 我可以使用:
SELECT (SELECT ParentId, CommentBody FROM Case.CaseComments) FROM Case
获取所有案例 cmets 的 ParentId 和 CommentBody 字段。然而,这是我没有得到的插页,或者找不到任何关于如何做的合理文档。
我更喜欢使用强类型查询,例如:
Case updateCase = new Case();
updateCase.Id = caseToAddToID;
updateCase.CaseComments = new QueryResult();
updateCase.CaseComments.records = (sObject[])new CaseComment[1];
updateCase.CaseComments.records[0] = new CaseComment();
((CaseComment)updateCase.CaseComments.records[0]).ParentId = caseToAddToID;
((CaseComment)updateCase.CaseComments.records[0]).CommentBody = noteToAdd;
binding.update(new sObject[]{updateCase});
但是当我做这样的事情时,我得到一个错误:
Error: getting record type info.
INVALID_FIELD: No such column 'CaseComments' on entity 'Case'.
If you are attempting to use a custom field, be sure to append
the '__c' after the custom field name. Please reference your WSDL
or the describe call for the appropriate names.
但如果我尝试仅在 caseComment 数据结构上使用 create(),它会正确插入,但不会正确关联到 Case,而且我似乎找不到它们。
【问题讨论】:
-
好吧,我错了。 Aparently 我提供了一个空 ID 字段。我让它工作了。
标签: c# soap wsdl salesforce