Solved

RenderToItem Error

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

20 Experts available now in Live!

Get 1:1 Help Now