在SalesForce中创建新用户时如果我提供已存在的ProfileID。
无效的交叉引用ID
User[] AddUser = new User[1];
User objuser = new User { Username = "balaji.balumca@gmail.com",
Alias = "Balu", // The ID of the user profile (Standard User, System Administrator, etc).
ProfileId = "00590000002Px2vAAC",
Email = "balaji.balumca@gmail.com",
EmailEncodingKey = "ISO-8859-1",
FirstName="Balaji",
LastName = "Balu",
LanguageLocaleKey = "pt_BR",
LocaleSidKey = "pt_BR",
TimeZoneSidKey = "America/Sao_Paulo" };
AddUser[0] = objuser;
SaveResult[] saveResults = _service.create(AddUser);
答案 0 :(得分:1)
你有ProfileId =" 00590000002Px2vAAC"但是005 ...不是用户的配置文件,配置文件以00e开头。使用其中一个模式/查询工具(例如SoqlX,Eclipse插件等)来查找正确的配置文件ID。
答案 1 :(得分:0)
private void CreateUser()
{
var _service = new SforceService();
var login = _service.login(ConfigurationManager.AppSettings["username"], ConfigurationManager.AppSettings["password"]);
User[] AddUser = new User[1];
User objuser = new User
{
Username = "Pavankumar.r@gmail.com",
Alias = "RPK",
// The ID of the user profile (Standard User, System Administrator, etc).
ProfileId = "00e90000001CcTnAAK",
Email = "Pavankumar.r@gmail.com",
EmailEncodingKey = "ISO-8859-1",
FirstName = "Pavan",
LastName = "Kumar",
LanguageLocaleKey = "pt_BR",
LocaleSidKey = "pt_BR",
TimeZoneSidKey = "America/Sao_Paulo"
};
AddUser[0] = objuser;
SaveResult[] saveResults = _service.create(AddUser);
string result = "";
if (saveResults[0].success)
{
//
}
else
{
//
}
}