Solved

RenderToItem Error

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

813 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

14 Experts available now in Live!

Get 1:1 Help Now