1

I added a Delete link in an xp:repeat to delete the document for the row, with "rowVar" the variable for the repeat to access thye document entries.

Here is the code for the Delete link in the repeat:

  <xp:link escape="true" id="link2"
                style="width:50.0px;display:inline-block" text="Delete">
                <xp:eventHandler event="onclick" submit="true"
                    refreshMode="partial" refreshId="panelChemLog" immediate="true">
                    <xp:this.action><![CDATA[#{javascript:
                    var deleteUNID = rowVar.getUniversalID();
                    println(deleteUNID);
                    var doc:NotesDocument = database.getDocumentByUNID(deleteUNID);
                    println(doc.getCreated() );
                    doc.remove(true);
                   }]]></xp:this.action>
                </xp:eventHandler>
            </xp:link>

I included the println statements and I can see in my log that the deleteUNID and doc object is set, but the code throws this exception on the final doc.remove(true) statement:

 Script interpreter error, line=5, col=5: [TypeError] Exception occurred calling method NotesDocument.remove(boolean) null

How do I code the Delete link to delete the document for the row in the repeat?

1 Answers1

3

I've seen this error before several times. Just tested to be sure. If the user does not have deletion privilege, it will throw such a meaningless error.

If you look at the Java stack trace, you can confirm by the following at the bottom of the trace.

NotesException: Notes error: You are not authorized to perform that operation

You might use database.queryAccessPrivileges(...) method to be sure within the code.

Serdar Basegmez
  • 3,355
  • 16
  • 20