function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Srinivasa Rao Balle 1Srinivasa Rao Balle 1 

Value not of required type in Date field in integratoin

Hi All,

I am developing partner wsdl java applicartion. from CSV file i am getting the date field value as  '09/12/2017'. how should i convert that date format to salesforce date format in using partner wsdl java application.

SObject so = new SObject();
so.setType("CustomObject__C");
so.setField("Effective_Date__c",   ? what is the way to convert this  '09/12/2017' date to saelsforce date format in my java application );
Chellappa NagarajanChellappa Nagarajan
Hi Srinivasa,

Please try the below code. I didn't try actually inserting into Salesforce using partner WSDL.
If this doesn't work , let me know. I will try the partner WSDL and try inserting data into salesforce directly.


String localVal  = "09/12/2017"; - You can replace this with value from CSV file
TimeZone tz = TimeZone.getTimeZone("EST");
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
sdf.setTimeZone(tz);
Date dateInst = sdf.parse(localVal);
SObject so = new SObject();
so.setType("CustomObject__C");
so.setField("Effective_Date__c",  dateInst);

I am assuming that your field is of type Date and not Date Time.
If it is DateTime, then you need to use Java Calendar class.. Let me know either way..
Regards,
Chellappa