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
RameshwarRameshwar 

How to set the selected datetime in ReminderDateTime field of Task object ?

Hi,
 
I am tried to set the selected datetime value in a reminderdatetime field of task object in the following format.
  1. Complete date plus hours and minutes:
      YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
  2. Complete date plus hours, minutes and seconds:
      YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
  3. Complete date plus hours, minutes, seconds and a decimal fraction of a
     second
      YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
but it gives me error when i try to use above format.
--------------------------------------------------------------------------------------------------- 
Exception :
{faultcode:'soapenv:Client', faultstring:''2007-12-25T00:00:00+05.5:30' is not a valid value for the type xsd:dateTime', }
---------------------------------------------------------------------------------------------------
I am trying to set the value in this datetime field by using following code 
+++++++++++++++++++++++++++++
var strReminderDate = document.getElementById("ReminderDateTime").value;//strReminderDate = yyyy/mm/dd
var strTime = document.getElementById("cboReminderDateTime").value //strTime = 00:00(hh:mm)
var remdateArr = new Array();
remdateArr = strReminderDate.split("/");
var remnewDate = remdateArr[2]+"/"+remdateArr[0]+"/"+remdateArr[1]+" "+strTime+"Z";
task.ReminderDateTime = new Date(remnewDate);
+++++++++++++++++++++++++++++
So how do I assign the selected date & time in the ReminderDateTime field 
of Activity Object through javaScript.
Thanks & Regards
Rameshwar
jf317820jf317820
i've had success with: YYYY-MM-DDTHH:NN:SSTZD --> (2008-01-30T04:37:14-05:00)

it's extremely important that leading zeros are included, otherwise it will throw an error...4:37:14 will not do, it must be 04:37:14.

Hope this helps.
RameshwarRameshwar
Hi,
 
Thanks for your reply and valuable information.
 
I tried in that way, whatever you said but it works in AJAX 9.0 and 10.0 toolkit but it throws an error when try to run the same code using the 11.1 version and shows me following error
 
 ---------------------------------------------------------------------------------------------------
Exception :
{faultcode:'soapenv:Client', faultstring:''2007-12-25T00:00:00+05.5:30' is not a valid value for the type xsd:dateTime', }
---------------------------------------------------------------------------------------------------
 
I have used sforce.internal.stringToDateTime() method to convert the string variable value in datetime format which is in connection.js file
 
<script src="/soap/ajax/11.1/connection.js" type="text/javascript"></script>
 
Thanks
Rameshwar
sfdcfoxsfdcfox


Rameshwar wrote:
Hi,
 
Thanks for your reply and valuable information.
 
I tried in that way, whatever you said but it works in AJAX 9.0 and 10.0 toolkit but it throws an error when try to run the same code using the 11.1 version and shows me following error
 
 ---------------------------------------------------------------------------------------------------
Exception :
{faultcode:'soapenv:Client', faultstring:''2007-12-25T00:00:00+05.5:30' is not a valid value for the type xsd:dateTime', }

---------------------------------------------------------------------------------------------------
 
I have used sforce.internal.stringToDateTime() method to convert the string variable value in datetime format which is in connection.js file
 
<SCRIPT src="/soap/ajax/11.1/connection.js" type=text/javascript></SCRIPT>
 
Thanks
Rameshwar



+05.5:30 isn't a valid time-zone. It should be +05:30 instead.
gmc74gmc74
I have two somewhat related questions that I am trying to resolve.
 
1) When I query the database from an s-control for a date/time, it returns it in this format 2008-02-29T20:25:30.000Z (YYYY-MM-DDTHH:MM:SS.hhhZ), is there an easy way to reformat this?
 
2)This is all coming through as GMT, is there an easy way to use the users time zone?
 
I listed my code below.
 
Thanks,
 
Code:
<html>
<head>
<script src="/soap/ajax/10.0/connection.js"></script>
<script src="/js/dojo/0.4.1/dojo.js"></script>

<script>
dojo.addOnLoad(init);


function init() {
var callback = {
onSuccess : displayResult,
onFailure : displayError
};
sforce.connection.query("SELECT Name, LastModifiedDate, Support_In_Out__c FROM User where Support_In_Out__c = 'In Office' Order By Name", callback);
}

function displayResult(result) {
var it = new sforce.QueryResultIterator(result);
var html = [];
html.push("<table border width=90%>");
html.push("<tr><td>");
html.push("<th colspan=6>In Office</th></tr></td>");
html.push("<th>Name</th>");
html.push("<th>Last Update</th>");
html.push("<th>Status</th>");
while(it.hasNext()) {
var record = it.next();

html.push("<tr Align=center>");
html.push("<td>" + record.Name + "</td>");
html.push("<td>" + record.LastModifiedDate + "</td>");
html.push("<td>" + record.Support_In_Out__c + "</td>");
html.push("</tr>");

}



document.getElementById("output-div").innerHTML = html.join("");
}

function displayError(error) {
document.getElementById("output-div").innerHTML =
"oops something went wrong ... " + error;
}
</script>


</head>
<body>

<div id="output-div"></div>

</body>
</html>