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
arundevarundev 

Event: bad field names on insert/update call: EndDateTime, StartDateTime

I want to create a new Event Record On click Of custom Button(By passing some values).

When I am passing the values for creating the record its give an error in these fields EndDateTime,StartDateTime of Event Table.

And the error is-

{errors:{fields:EndDateTime,StartDateTime, message:'Event: bad field names on insert/update call: EndDateTime, StartDateTime', statusCode:'INVALID_FIELD_FOR_INSERT_UPDATE', }, id:null, success:'false', }

 

I am inserting these values in Production system it gives above error.

But,When I am inserting the same values in our development system it didn't produces any error.

Code:-

I am using this java script-

 

var eEvent=new sforce.SObject("Event");

eEvent.OwnerId="{!SE_Request__c.OwnerId}";

eEvent.WhatId="{!SE_Request__c.Id}";

if("{!SE_Request__c.ContactId__c}" != "")

{

eEvent.WhoId ="{!SE_Request__c.ContactId__c}";

}

if("{!SE_Request__c.LeadId__c}" != "")

{

eEvent.WhoId ="{!SE_Request__c.LeadId__c}";

}

eEvent.Description="{!SE_Request__c.Description__c}";

eEvent.DurationInMinutes=60;

eEvent.ActivityDate=date("{!Today}");

eEvent.ActivityDateTime=date("{!SE_Request__c.Preferred_Start_Date_Time__c}");

eEvent.StartDateTime=date("{!SE_Request__c.Preferred_Start_Date_Time__c}");

eEvent.EndDateTime=date("{!SE_Request__c.Preferred_Start_Date_Time__c}");

eEvent.ReminderDateTime=dateRem(my_time);

var result = sforce.connection.create([eEvent]);

var eEventAtt=new sforce.SObject("EventAttendee");

eEventAtt.AttendeeId="{!SE_Request__c.OwnerId}";

var resultAtt = sforce.connection.create([eEventAtt]);

 

 

it gives an error in this line(Red Line).

Error is –

{errors:{fields:EndDateTime,StartDateTime, message:'Event: bad field names on insert/update call: EndDateTime, StartDateTime', statusCode:'INVALID_FIELD_FOR_INSERT_UPDATE', }, id:null, success:'false', }

RainManRainMan
I'm new to salesforce... but happened to stumble across your question.  I'm taking a big step by trying to answer your question.  So be kind.... ;)
 
However, I think you might have a version conflict between your dev and production environments.   These fields are specified as: "Available in version 13.0 and later"  in the API documentation.
 
Is it possible you are on 2 different versions?  I can't find documentation on how to specify or even figure out which version is being executed by an s-control.
 
Just thought I would throw out the idea, until someone more knowledgeable comes along.  Good luck!


Message Edited by RainMan on 09-29-2008 12:05 PM
arundevarundev
Thanks For Reply...

I am using  "version 13.0". in both the System . As for as i am concern this error is not generate due to the version difference.
both 'StartdateTime' and 'EnddateTime' has a same data type datetime.   and in this js I am inserting datetime value in ActivityDatetime Field (having datatype DateTime) also and we didn't get error in this field..

 the error we are getting the error "Event: bad field names on insert/update call: EndDateTime, StartDateTime".

May be error produces for the Field name in the Data base.

I am still searching the solution......
SteveBowerSteveBower
Normally with Salesforce, when the same bit of code works on one login, but not on another, I don't start by questioning the code, I start by asking what is different between the two accounts.  (Of course it may end up being the code...)

In this case I'd ask if the permissions and access for the fields in the event object are the same for both logins?

Best, Steve.

p.s. I might also look at the contents of the "Description" field.  If you search the boards you'll find references to the problem that arises when you try to substitute a Textarea field using the "{!xxxx}" syntax, especially if there are line breaks in the textarea.
If that hasn't bit you yet, it might.  The typical way to fix it is to create a hidden textarea element in your html and give it the value using the {!  } syntax.  Then access it via getElementById('id of the dummy element').value.

Here's a link:  http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=5340