I have the following code in a xpage postSaveDocument event. It works fine.
var db:NotesDatabase = session.getDatabase(session.getServerName(), “TimeOffxp.nsf”);
var agent:NotesAgent = db.getAgent;
agent.runOnServer(dominoDocument1.getNoteID());
Now, I want to add a condition so it only run when it is a new document. I tried the following codes and none of them seems work for me.
(1)
var db:NotesDatabase = session.getDatabase(session.getServerName(), “TimeOffxp.nsf”);
var agent:NotesAgent = db.getAgent;
@If(@IsNewDoc()==1,agent.runOnServer(dominoDocument1.getNoteID()));
(2)
var db:NotesDatabase = session.getDatabase(session.getServerName(), “TimeOffxp.nsf”);
var agent:NotesAgent = db.getAgent;
if(@IsNewDoc()==1){
agent.runOnServer(dominoDocument1.getNoteID());
}
Please advise what are the correct ways/formats to set if condition in xpage. Thanks.