Reputation: 33
When we declare a dominoDocument as an XPages datasource, we can specify the documentid programmaticaly. However, I've not found a way to trap the error if the specfied id does not exist. I get an error 500 / Could not open document error on the log.
I would expext to get a null "document1" or something but be able to catch error nicely.
<xp:this.data>
<xp:dominoDocument var="document1" action="openDocument" documentId="some noteId here" formName="Document" ignoreRequestParams="true">
<xp:this.databaseName>...</xp:this.databaseName>
</xp:dominoDocument>
</xp:this.data>
Any hint ?
thanks
Upvotes: 2
Views: 1880
Reputation: 30960
You can put the error handling in your code for calculating the documentid.
<xp:this.documentId><![CDATA[#{javascript:
var id = "your calculated id";
try {
database.getDocumentByUNID(id);
} catch(e) {
context.redirectToPage("pageError", true);
}
return id}]]>
</xp:this.documentId>
Like in example above you can open e.g. an error page.
Upvotes: 4