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
vivek.kumar.ax1255vivek.kumar.ax1255 

SalesForce Opportunity Field inset Error

I am integrating with salesforce through java there in Opportunity there is a field named CloseDate . my code for the same is opportunitySObject.setField("CloseDate", "2010-01-01"); but i getmessage='Close Date: value not of required type: 2010-01-01' statusCode='INVALID_TYPE_ON_FIELD_IN_RECORD'

what i see by quering the database is CloseDate in 2010-01-01 format i.e. yyyy-MM-dd.

Please help.

NasipuriNasipuri

You need to change the line  opportunitySObject.setField("CloseDate", "2010-01-01")

 

Instead of passing String for the date you need to pass an object of  java.util.Calendar type. 

      

java.util.GregorianCalendar myCloseDate = new GregorianCalendar();       
myCloseDate.set(2001, (01 -1), 01);

 opportunitySObject.setField("CloseDate", myCloseDate);

 

 

Thanks and Regards,

DInesh Nasipuri

Dinesh.Nasipuri@gmail.com