You need to sign in to do that
Don't have an account?
Kyriacos 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();
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();
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();