问题描述
一个简单的问题,我试图通过使用“用户名”作为外部 ID 将用户记录Upsert 写入 Salesforce。但我收到以下“DUPLICATE_USERNAME”错误:
“用户名重复。
该用户名已存在于该或其他 Salesforce 组织中。用户名在所有 Salesforce 组织中必须是唯一的。要解决,请使用不同的用户名(不需要与用户的电子邮件地址匹配) ).DUPLICATE_USERNAME"
我知道我的组织中已经有一个用户使用了这个确切的“用户名”,所以我希望记录会被更新,而且由于它不会创建新记录,所以重复的用户名应该不是问题吗?.. . 是不是我对 Upsert 操作的理解有误?
邮递员更新请求:
curl --location --request PATCH 'https://************.my.salesforce.com/services/data/v51.0/sobjects/User/Username/srj@************.co.uk.Invalid' \
--header 'Authorization: Bearer ************' \
--header 'Content-Type: application/json' \
--data-raw '{
"FirstName": "S","LastName": "RJ","Alias": "srj","Email": "[email protected]","ContactId": "0031w00000nviAVAAY","ProfileId": "00e1w000000I0GEAA0","CommunityNickname": "srj","EmailEncodingKey": "UTF-8","TimeZonesidKey": "Europe/London","LocaleSidKey": "en_GB","LanguageLocaleKey": "en_US"
}'
邮递员 Upsert 400 响应:
[
{
"message": "Duplicate Username.<br>The username already exists in this or another Salesforce organization. Usernames must be unique across all Salesforce organizations. To resolve,use a different username (it doesn't need to match the user's email address). ","errorCode": "DUPLICATE_USERNAME","fields": [
"Username"
]
}
]
非常感谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)