Solved

RenderToItem Error

Posted on 2013-01-18
5
563 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 10

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 10

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now