Solved

RenderToItem Error

Posted on 2013-01-18
5
574 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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