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
Peter Russell 9Peter Russell 9 

Help me please! JSON parse error

Trying to create an opportunity but its not working.
This is a log of what is being posted:

 addorUpdateOpportunity: calendarId:18127604 time:Mon Oct 01 11:00:00 UTC 2018 eventId:00U1v00000JhtMaEAJ
2018/09/28 17:09:25 | setting Date_client_paid__c:
2018/09/28 17:09:25 | setting Description:
2018/09/28 17:09:25 | setting Customer_Enquiry__c:qweewqewq
2018/09/28 17:09:25 | setting Assigned_to__c:TimeTap
2018/09/28 17:09:25 | setting StageName:Advice session booked
2018/09/28 17:09:25 | setting Customer_Disposition__c:Paid
2018/09/28 17:09:25 | setting VAT__c:Yes
2018/09/28 17:09:25 | setting Office__c:Aberdeen
2018/09/28 17:09:25 | setting Agreed_selling_price__c:0.10
2018/09/28 17:09:25 | setting Amount:0.10
2018/09/28 17:09:25 | setting Method_of_appointment__c:in person
2018/09/28 17:09:25 | setting Payment_Status__c:Paid via website
2018/09/28 17:09:25 | setting Amount_paid__c:
2018/09/28 17:09:25 | setting CloseDate:2018-10-01
2018/09/28 17:09:25 | setting Name:Camabire hottss - EEA Family Member Advice Package
2018/09/28 17:09:25 | setting CampaignId:7010Y000000kFZGQA2
2018/09/28 17:09:25 | setting Caseworker__c:Uche Uwaezuoke
2018/09/28 17:09:25 | setting Payment_reference__c:
2018/09/28 17:09:25 | setting Service_sold__c:Advice
2018/09/28 17:09:25 | setting ForecastCategoryName:Commit
2018/09/28 17:09:25 | setting Client_s_appointment__c:2018-10-01T11:00:00Z
2018/09/28 17:09:26 | com.force.api.ApiException: [{"message":"Cannot deserialize instance of date from VALUE_STRING value  or request may be missing a required field at [line:1, column:26]","errorCode":"JSON_PARSER_ERROR"}]


Any help appreciated
Alain CabonAlain Cabon
Hi,

You can get the required fields with this code in the anonymous window (CTRL + E) in the developer console.
Schema.DescribeSObjectResult d = Opportunity.sObjectType.getDescribe();
Map<String, Schema.SObjectField> FsMap = d.fields.getMap();
for(String fieldName : FsMap.keySet()) { 
    Schema.SObjectField field = FsMap.get(fieldName);
    Schema.DescribeFieldResult f = field.getDescribe();
    if(!f.isNillable()  && !f.isDefaultedOnCreate()) {
        system.debug(fieldName + ' type:' + f.getType() + ' - is Required and not defaulted on create');
    }
}

setting CloseDate:2018-10-01 is required and correct.