You need to sign in to do that
Don't have an account?
rschenkel
Custom field created as null
I created a custom field in Account. I redownloaded my WSDL and the field show up without problem. However, when I run the create function the custom field gets created as null instead of the value I supplied.
Any help would be appreciated.
Using upsertResult instead of create works.
What toolkit are you using? what's your code ?
private bool UpdateAccount(double dCorpCode, string strName, string strAddress1, string strAddress2, string strCity, string strProvince, string strCountry, string strPostalCode)
{
try
{
Account[] accounts = new Account[1];
accounts[0] = new Account();
accounts[0].ExId__c = dCorpCode.ToString();
accounts[0].AccountNumber = dCorpCode.ToString();
accounts[0].Name = strName;
if (String.IsNullOrEmpty(strAddress2) == true)
accounts[0].BillingStreet = strAddress1;
else
accounts[0].BillingStreet = strAddress1 + "\n" + strAddress2;
accounts[0].BillingCity = strCity;
accounts[0].BillingState = strProvince;
accounts[0].BillingCountry = strCountry;
accounts[0].BillingPostalCode = strPostalCode;
UpsertResult upsertResult = _sforceService.upsert("ExId__c", accounts)[0];
if (upsertResult.success == false)
{
// TODO: Log error
Error[] errors = upsertResult.errors;
return false;
}
return true;
}
catch (Exception e)
{
// TODO: Log error
return false;
}
}
The only custom field you're setting is extId__c, which must have a value if the upsert call is succeeding.
Thanks Simon. That was the code that I actually got working. I was looking for the old create call but could not find it. I was not able to create or update custom fields using create or update. However, the code above does work with upsert.