metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Balendra Singh <balendrasi...@gmail.com>
Subject Date format to insert in salesforce
Date Fri, 23 Aug 2013 07:38:26 GMT
Hi,


I added a test in SalesforceDataContextTest to insert the record in
contacts table in saleforce. This record has a birthdate value with format
as (SOQL_DATE_FORMAT_IN = "yyyy-MM-dd";).

*public void testInsertInContactsWithBirthdate() throws Exception {*
*     *
*     *
*     if (!isConfigured()) {*
*            System.err.println(getInvalidConfigurationMessage());*
*            return;*
*        }*
*     *
*     SalesforceDataContext dc = new SalesforceDataContext(getUsername(),
getPassword(), getSecurityToken());*
*
*
*        final String tableName = "Contact";*
*        final String firstName = "rob";*
*        final String lastName = "john";*
*        final String date = "08-08-1980";*
*        *
*        SimpleDateFormat format = new
SimpleDateFormat(SalesforceDataContext.SOQL_DATE_FORMAT_IN);*
*        final Date dateValue = format.parse(date);*
*        *
*        dc.execu*teUpdate(new UpdateScript() {
*            @Override*
*            public void run(UpdateCallback callback) {*
*                callback.insertInto(tableName).value("FirstName",
firstName).value("LastName", lastName).value("BirthDate",
dateValue).execute();*
*            }*
*        });*
*     *
*    }*

I am not able to insert this record in salesforce due to
FIELD_INTEGRITY_EXCEPTION for date as shown in below -
*
*
*java.lang.IllegalStateException: 1 out of 1 object(s) could not be
inserted in Salesforce! The first error message was: *
*'Birthdate: invalid date: Sun Dec 31 00:00:00 GMT 13'
(FIELD_INTEGRITY_EXCEPTION). see error log for further details.*
*
*
so what should be desired date format for salesforce so that it can be
inserted.

Thanks,
Balendra

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message