Solved

RenderToItem Error

Posted on 2013-01-18
5
568 Views
Last Modified: 2013-11-16
Greetings and salutations, experts!

My Domino server is at R8.5.2 and the operating system on Windows 2003 Enterprise. I have an agent that is manually run by the user to send out announcements. Normally it runs just fine but this one time he received an error on the line, "success = newdoc.RenderToRTItem(rtitem)". The error message was "Error 4000 - Invalid or nonexistent document".

I did my due diligence and looked around the 'net for answers and the closest thing that I could come to an answer was to save the doc that was created to capture the render.

Do you have any other insight as to why this may have happened?

Thank you.

Regards - Notes Rookie
0
Comment
Question by:notesrookie
  • 2
  • 2
5 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 38794081
Just a hunch: could it be that one of the fields in the document has a value that's invalid to the form? The error 4000 did have other or more meanings in the past, e.g. note item not found.
0
 
LVL 11

Accepted Solution

by:
larsberntrop earned 500 total points
ID: 38796276
It all depends on how the variable newdoc is initialized.

From the Notes Designer Help on RenderToRTitem:
The picture is created using both the document and its form. Therefore, the input translation and validation formulas of the form are executed.
If the target rich text item is in a new document, you must save the document before calling RenderToRTItem.

from you line of code:
newdoc is the document which needs to be put into the rtitem.
rtitem is a NotesRichTextItem on a different document, to be sent as announcement.

rtitem should already be created on a saved document.
newdoc should not be a deleted or invalid document (see flags NotesDocument.IsDeleted and NotesDocument.IsValid).
Explanation: This can occur if the reference to newdoc is obtained from a view which was not updated after that document was changed and now would be no longer accessible from that view. And in other scenarios too.
Solution: check for IsValid and IsDeleted before attempting operations on the document.

The error can occur
0
 
LVL 11

Expert Comment

by:larsberntrop
ID: 38796299
Another source for the error might lie in the input translation and validation formula's.  If one of those formula's access a document which is invalid or deleted, the same error occurs.

This you could check by using NotesDocument.ComputeWithForm, and catching the error, like:
If Not newdoc.IsDeleted And newdoc.IsValid Then
    success = newdoc.ComputeWithForm(False, False)
    If success Then
        success = newdoc.RenderToRTItem(rtitem)
    End If
End If
'the code below is probably already in place since you set a success variable
If not success Then
        ' report invalid document to user or log or both
        ' and skip sending document. this might involve exiting, or continuing top process other documents.
Else
'do sending etc
End If

Open in new window

0
 

Author Comment

by:notesrookie
ID: 38797281
Thank you, larsberntrop. Let me check my code on that to see if that is the case.

Regards - Jade
0
 

Author Comment

by:notesrookie
ID: 38799715
Yes, that was the case. Never had this issue with the code before but it would make sense to save it. Thank you for the confirmation.

Regards - Notes Rookie.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question