You need to sign in to do that
Don't have an account?
Bablu
populate current date when we click on [Accept] custom button on case
Hi,
I want to populate current date and time in custom field (case accepted date) when i click on [Accept] custom button on case
Existing code on [Accept] button which updates the ownership, now i want to include the code to update case accepted date also. can you help on this
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.OwnerId = '{!$User.Id}';
var result = sforce.connection.update([caseObj]);
if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
location.reload(true);
}
Thanks,
Bablu
I want to populate current date and time in custom field (case accepted date) when i click on [Accept] custom button on case
Existing code on [Accept] button which updates the ownership, now i want to include the code to update case accepted date also. can you help on this
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.OwnerId = '{!$User.Id}';
var result = sforce.connection.update([caseObj]);
if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
location.reload(true);
}
Thanks,
Bablu
I have updated your code. Please find the below code,
Thanks,
Vinoth
Thanks for your help Vinoth. small issue in the format : 2015-10-19T15:47:04.604+05.5:30
i want 2015-10-19 only . could you please look at this ?
Thanks,
Bablu
I have updated the code for the format you required,
Please find the below updated code,
Updated line is given below,
caseObj.Accepted_Date__c = (new Date().toISOString()).substring(0,10);
Thanks,
Vinoth
Still the same issue. how to remove T16:27:27.485+05.5:30 from the below date
Accepted Date : 2015-10-19T16:27:27.485+05.5:30
I have created the text field Accepted Date and tested the above code. The output is: 2015-10-19 is Populated in the text field.
caseObj.Accepted_Date__c = (new Date().toISOString()).substring(0,10);
The abvoe line of code removes the "T16:27:27.485+05.5:30" part and only popualtes 2015-10-19.
Thanks,
Vinoth
Hi, are you usingh the Text field only or Date/Time field ?
Accepted_Date__c ?
Can you see the below screen , still it displys the incorrect format
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var caseObj = new sforce.SObject("Case");
caseObj.Id = '{!Case.Id}';
caseObj.OwnerId = '{!$User.Id}';
var currentDate =
caseObj.Case_Accepted__c = (new Date().toISOString()).substring(0,10);
var result = sforce.connection.update([caseObj]);
if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
location.reload(true);
}