我正在尝试从Salesforce中的对象帐户更新一个字段(TestAccount__c),我已经将.net(C#)中的企业wsdl链接起来,但由于我缺乏经验,我发现这很棘手,任何人都可以帮忙我请:这是我到目前为止所做的:
sforce是sf wsdl的名称
namespace UpdateSF
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
sforce.Account updatefield= new sforce.Account();
if (updateField != null)
{
updateField.TestAccount__c = "Done";
}
else
{
}
//this is not right
sforce.SaveResult[] result = updateField.update(new sforce.sObject[] { updateField });
}
}
}
}
答案 0 :(得分:1)
我认为它应该是这样的:
// setup binding (in init code)
sforce.SforceService binding = new sforce.SforceService();
sforce.LoginResult lr = binding.login("username", "password");
binding.Url = lr.serverUrl;
binding.SessionHeaderValue = new sforce.SessionHeader();
binding.SessionHeaderValue.sessionId = lr.sessionId;
// update account
sforce.Account updateAccount = new sforce.Account();
updateAccount.Id = "..."; // account id
updateAccount.TestAccount__c = "Done";
sforce.SaveResult[] result = binding.update(new sforce.sObject[] { updateAccount });
// todo: check result