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
Kyriacos TheohariKyriacos Theohari 

Create a date button on the account object

Hi I have tried to create a date button on the account object but receive the following error message:

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'soapenv:Client', faultstring:''Thu Nov 02 2017 16:12:12 GMT+0000 (GMT Standard Time)' is not a valid value for the type xsd:date', }


This is my button details:

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}

// identify the record
var a = new sforce.SObject("Account");
a.id = "{!Account.Id}";

// Get the user Info
var user = sforce.connection.getUserInfo();
// make the field change
a.Plus_Chat_Customer_Contacted_Date__c = '{!DAY(TODAY())}';

// save the change
sforce.connection.update([a]);

//refresh the page
window.location.reload();
Prakash NawalePrakash Nawale
Kyriacos Theohari,
Plus_Chat_Customer_Contacted_Date__c is date field and you are putting number value, I mean day.
You need to assign field value as
 a.Plus_Chat_Customer_Contacted_Date__c =new Date(Date.parse( '{!TODAY()}'));

OR
 a.Plus_Chat_Customer_Contacted_Date__c =  Date.now();