This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jan 20, 2012, 10:05 AM
31 Posts
topic has been resolvedResolved

Strange behaviour get error

  • Category: Debugging
  • Platform: All
  • Release: 8.5.3
  • Role:
  • Tags:
  • Replies: 2
When I create a new page and either attach a file or attache a picture of the rich text field before I saved the document once I get the following error.
But if i have only used the text in rich text field and saved it once, I can then easily attach files or insert pictures in rich text field without error?

Any suggestions?
 
ERROR MESSAGE
Error while executing JavaScript action expression
Script interpreter error, line=7, col=11: [TypeError] Exception occurred calling method NotesXspDocument.save() null

JavaScript code

   1: //Document1
   2: document1.setValue("Status","Pending");
   6: //Save functions
   7: document1.save();
   8: //ReDirect to page
   9: context.redirectToPage("overview")
Jan 20, 2012, 1:31 PM
31 Posts
Re: Strange behaviour get error
 If i use this instead i get this error
 

Expression

   1: #{javascript://Document1
   2: var doc:NotesDocument = document1.getDocument();
   3: //Set field
   4: document1.setValue("Status","Pendinf");
   7: //Save functions
   8: save(doc,true);
   9: //ReDirect to page
  10: context.redirectToPage("overview")
  11: }
 
 
Error while executing JavaScript action expression
Error saving data source document1
Could not save the document NEW_594 NotesException: Item Body already exist
Jun 12, 2012, 3:57 PM
9 Posts
Re: Strange behaviour get error
 I used to get this "item already exists" error all the time on an XPage application I look after.
 
From memory it was something to do with the fact that on a new document XPage that has an RTF field, if you save the document and haven't added any content to the RTF field, notes saves it as a Text field, not Rich Text. Then when you come to use it later it would complain that the item already exists.
 
I added a function that's called as part of the query save code that has stopped this error completely. I'm not saying this is the best way to do it but it works for my application: 
 
var fieldItem:NotesItem = currentDocument.getDocument().getFirstItem("xxxxxx");
if (fieldItem==null){
// create the field as an RTF
writeToLog("Creating xxxxx field");
var rtItem:NotesRichTextItem = currentDocument.getDocument().createRichTextItem("xxxxx");
currentDocument.save();
}else if (fieldItem.getType()==1280){
writeToLog("--> Converting xxxxx to RTF");
currentDocument.replaceItemValue("xxxxxTEXT", fieldItem.getText());
fieldItem.remove();
var rtItem:NotesRichTextItem = currentDocument.getDocument().createRichTextItem("xxxxx");
currentDocument.save();

 
So the system tidies up rich text items on the document when they are in the wrong format (existing documents prior to this fix), and the first time a new  document is saved, if there is no text in the RTF field on the XPage, the above code will create a new empty RTF field on the document instead of allowing the server to save the document and create a plain Text field. 
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal