首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法将Contact RecordType设置为Contact by API

无法将Contact RecordType设置为Contact by API
EN

Stack Overflow用户
提问于 2019-07-11 21:40:22
回答 1查看 63关注 0票数 0

我已经创建了一个C#项目,以WebReference身份连接Salesforce Enterprise WSDL并尝试创建联系人

代码语言:javascript
复制
var recordTypes = sforceService.query("select Id from RecordType where sObjectType = 'Contact'");

var contact = new Contact
    {
      LastName = textTemplate,
      RecordType = (RecordType)recordTypes.records[0],
      Email = textTemplate + "@test.com",
      Phone = "1234567890",
    };

    res = sforceService.create(new sObject[] { contact });

并得到一个错误:"Field name provided, Id is not an External ID or indexed field for RecordType"

在这种情况下,应该如何设置RecordType?

UPD。我应该填充string RecordTypeId字段而不是RecordType RecordType字段

代码语言:javascript
复制
RecordTypeId = recordTypes.records[0].Id
EN

回答 1

Stack Overflow用户

发布于 2019-07-14 22:27:43

代码语言:javascript
复制
ID  recordTpeId=Schema.SObjectType.Contact.getRecordTypeInfosByName().get('recordTypeName').getRecordTypeId();
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56990605

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档