• rschenkel
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 9
    Replies

I’m using the upsert command to update Account records.  I am updating standard and custom fields.  All standard fields are being updated successfully as are textual (string) and picklist custom fields.  However, all custom fields of other types (double?, bool?, etc.) are not updating.

 

When dealing with non-textual data do I have to do something special?

 

Thanks.

I am an enterprise customer and can log into the production environment through the API.  Today I created a sandbox (I guess developer version) of my production environment.  I am unable to log into the sandbox version.  I logged into the sandbox version through a web portal and generated an sercurity token.  I am using username.sandboxname and passwordtoken.  Here is the code:

 

        private bool Login(string strUsername, string strPassword, string strToken)
        {
            // Timeout after a minute
            _sforceService.Timeout = 60000;

            // Try loggin in
            LoginResult loginResult;
            try
            {
                loginResult = _sforceService.login(strUsername, strPassword + strToken);
            }
            catch (SoapException e)
            {
                return false;
            }

            if (loginResult.passwordExpired)
                return false;

            // Reset the endpoint of the service to the virtual server instance that is servicing our organization
            _sforceService.Url = loginResult.serverUrl;

            // Set the persistent SOAP header.
            _sforceService.SessionHeaderValue = new SessionHeader();
            _sforceService.SessionHeaderValue.sessionId = loginResult.sessionId;
            return true;
        }

 

 

 

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.

I’m using the upsert command to update Account records.  I am updating standard and custom fields.  All standard fields are being updated successfully as are textual (string) and picklist custom fields.  However, all custom fields of other types (double?, bool?, etc.) are not updating.

 

When dealing with non-textual data do I have to do something special?

 

Thanks.

I am an enterprise customer and can log into the production environment through the API.  Today I created a sandbox (I guess developer version) of my production environment.  I am unable to log into the sandbox version.  I logged into the sandbox version through a web portal and generated an sercurity token.  I am using username.sandboxname and passwordtoken.  Here is the code:

 

        private bool Login(string strUsername, string strPassword, string strToken)
        {
            // Timeout after a minute
            _sforceService.Timeout = 60000;

            // Try loggin in
            LoginResult loginResult;
            try
            {
                loginResult = _sforceService.login(strUsername, strPassword + strToken);
            }
            catch (SoapException e)
            {
                return false;
            }

            if (loginResult.passwordExpired)
                return false;

            // Reset the endpoint of the service to the virtual server instance that is servicing our organization
            _sforceService.Url = loginResult.serverUrl;

            // Set the persistent SOAP header.
            _sforceService.SessionHeaderValue = new SessionHeader();
            _sforceService.SessionHeaderValue.sessionId = loginResult.sessionId;
            return true;
        }

 

 

 

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.

The code below runs fine and prints the ID of the newly created object, but when I look in the app, AnnualRevenue is blank!

sforce.Account newAcc = new sforce.Account();
newAcc.Name = "Test Account";
newAcc.AnnualRevenue = 10000;
sforce.SaveResult [] sr = svc.create ( new sforce.sObject[] { newAcc } );
if(sr[0].success)
{
Console.WriteLine("new id of account is {0}", sr[0].id); } else {
Console.WriteLine("error creating account {0}", sr[0].errors[0].message);
}


What's happening is that for field type's that do not support being null in .NET, the generated .NET code includes an additional property that indicates if it should send the value. Unfortuanly even if you explicitly set a value, the property that says to send the value doesn't get set. You need to also set that property as well. These properties have "Specified" appended to the property name they apply to, so the above example should be

sforce.Account newAcc = new sforce.Account();
newAcc.Name = "Test Account";
newAcc.AnnualRevenue = 10000;
newAcc.AnnualRevenueSpecified = true;
sforce.SaveResult [] sr = svc.create ( new sforce.sObject[] { newAcc } );
if(sr[0].success)
{
Console.WriteLine("new id of account is {0}", sr[0].id); } else {
Console.WriteLine("error creating account {0}", sr[0].errors[0].message); }
}

If you run this revised version, you'll see the AnnualRevenue value in the application. Properties of type DateTime, bool, int and double all have these additional specified flags.