This recipe shows how to display the current date and time in an object datasource.
Steps taken:
- Create an object datasource (Now.ds).
- Enter the following script into the “DataSource Wizard > JavaScript” tab:function pushTo(cxt, dl)
{
dl.startData(this);
var rec = this.newRecordInstance();
var data = rec.getData();
data[0] = new java.util.Date();
dl.processRecord(rec);
dl.endData(this);
}
You will see the current date and time upon clicking “Load Data”.
To download the necessary files for this recipe, refer to the attached ZIP package.
Now.zip