Skip to main content

Save some documents but not others

Comments

5 comments

  • Richard Moir

    Assuming you are writing a DocumentOperation, I think the nicest way is to throw a DocumentOperationException as soon as you decide not to save the document. Pass a message into the exception explaining why and that will be displayed to the user.

    0
  • Richard Moir

    That also assumes you are only doing one document. If you have many, then don't add the documents you don't want to save to the list of results that are returned.

    0
  • Matthew Shum

    ^ True. Thanks.

    I guess my main issue is with saveDocument(). I tried to call it but it won't save the document in question to the folder. So I am not sure if I am using the method correctly.

    0
  • Richard Moir

    If you have just created a new document then you shouldn't call saveDocument(). That is only used if you are modifying a document that is already in the database.

    To save a new document to the database then you can call DocumentUtilities.addGeneratedDocument

    0
  • Matthew Shum

    Sorry, I want to save an intermediate document to the database. I will try to call DocumentUtilities.addGeneratedDocument. Thanks!

    Update: This solved my needs! Thanks!

    0

Please sign in to leave a comment.