You need to sign in to do that
Don't have an account?
Jos vd Have
Custom button with javascript - copy date value
Hi all,
I'm struggling with the dates in JS.
Below is my code but whatever I try I end up with an error saying "Invalid time value"
the problem is in the bold code line.
Thx in advance...
Jos
{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/37.0/apex.js" )}
var Status = "{!Case.Status}";
var newRecords = [];
if (Status != "Gesloten")
{
var c = new sforce.SObject("Case");
c.RecordTypeID = "012b0000000YfFNAA0";
c.AccountId = '{!Case.AccountId}';
c.ContactId = '{!Case.ContactId}';
c.ParentId = '{!Case.Id}';
c.Complaint_Type__c = "Standaard klacht";
c.Subject = '{!Case.Subject}';
c.Status = "In behandeling";
c.Substatus__c = "Beoordelen klacht";
c.Origin = '{!Case.Origin}';
c.Contract__c = '{!Case.Contract__c}';
c.Business_Unit__c = '{!Case.Business_Unit__c}';
c.Department__c = '{!Case.Department__c}';
c.Preferred_Contact_Method__c = '{!Case.Preferred_Contact_Method__c}';
c.Initial_opened_date__c = new Date('{!Case.CreatedDate}').toISOString();
newRecords.push(c);
result = sforce.connection.create(newRecords);
alert ('Klacht case is aangemaakt.');}
else
{
alert ('Case mag niet gesloten zijn voor deze actie.');
}
I'm struggling with the dates in JS.
Below is my code but whatever I try I end up with an error saying "Invalid time value"
the problem is in the bold code line.
Thx in advance...
Jos
{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/37.0/apex.js" )}
var Status = "{!Case.Status}";
var newRecords = [];
if (Status != "Gesloten")
{
var c = new sforce.SObject("Case");
c.RecordTypeID = "012b0000000YfFNAA0";
c.AccountId = '{!Case.AccountId}';
c.ContactId = '{!Case.ContactId}';
c.ParentId = '{!Case.Id}';
c.Complaint_Type__c = "Standaard klacht";
c.Subject = '{!Case.Subject}';
c.Status = "In behandeling";
c.Substatus__c = "Beoordelen klacht";
c.Origin = '{!Case.Origin}';
c.Contract__c = '{!Case.Contract__c}';
c.Business_Unit__c = '{!Case.Business_Unit__c}';
c.Department__c = '{!Case.Department__c}';
c.Preferred_Contact_Method__c = '{!Case.Preferred_Contact_Method__c}';
c.Initial_opened_date__c = new Date('{!Case.CreatedDate}').toISOString();
newRecords.push(c);
result = sforce.connection.create(newRecords);
alert ('Klacht case is aangemaakt.');}
else
{
alert ('Case mag niet gesloten zijn voor deze actie.');
}
Laraib_Jafri
Is Initial_opened_date__c a date/time field or Text field?
Jos vd Have
Hi, it is a date/time field