1
votes

I am getting the following error when trying to set a date value using @Date value with replaceItemValue.

The error I am getting occurs on the last line of code here:

var dt = @Date(2012,1,1);
docContractor.replaceItemValue("NewField","Hello World");
docContractor.replaceItemValue("ContractorStartDateTime",dt);

The error is:

Error while executing JavaScript action expression Script interpreter error, line=21, col=31: [TypeError] Exception occurred calling method NotesDocument.replaceItemValue(string, Date) null

How can I fix this?

2

2 Answers

3
votes

The following works:

docContractor.replaceItemValue("ContractorStartDateTime", session.createDateTime("Today"));

You can find more examples in the Notes and Domino App Dev wiki: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/NotesDateTime_sample_JavaScript_code_for_XPages

0
votes

Did you try to use a NotesDateTime object instead? Or use toString ()