bookmark_borderFRULE: NotesException: Note delete failed

Error while saving document
Could not save the document NEW_1d NotesException: Note delete failed

NotesException: Note delete failed
lotus.domino.local.Document.Nsave(Native Method)
lotus.domino.local.Document.save(Unknown Source)
lotus.domino.local.Document.save(Unknown Source)
com.ibm.xsp.model.domino.wrapped.DominoDocument.save(DominoDocument.java:1087)
com.ibm.xsp.model.domino.DominoDocumentData.doSaveDocument(DominoDocumentData.java:567)
com.ibm.xsp.model.AbstractDocumentDataSource.save(AbstractDocumentDataSource.java:76)

what the heck is this???
I only found a very old note in the 6/7 LN forum. The guy thought it was related to some “null value vector”..

any ideas?

Update:
It happens when you try to put a NULL value vector somewhere, see also this blog It’s a feature not a bug!

bookmark_borderQUINDIP: computed when composed fields in xPages

Did you ever wonder how you can “mimick” the cold computed when composed fields?

According to Brad Balassaitis there ain’t no equivalent in xPages.
According to Oliver Busse you can “fake” them anyway

Steps I would propose:

  • create a normal editable field and set it “disabled”
  • use this css to remove the border of the input: input[disabled]{border: 0px;}
  • use Olivers approach to add a value when the doc is first opened

<xp:actionGroup>

    <xp:setValue binding=”#{docCurrent.docRequestID}”

      value=”#{javascript:@Unique()}”>

        </xp:setValue>


            <xp:setValue binding=”#{docCurrent.docCreationDate}”

              value=”#{javascript:@Now()}”>

                </xp:setValue>

                  </xp:actionGroup>

                  It looks like this in the binding dialog:

                  I tested it, I think quite thoroughly: it works. I also tried to “change” the value via Inspector in the HTML source code.. after save&reload the old value was back.. so Notes seems to “know” which fields CAN and CANNOT be edited!! This is great news!
                  the fields are setup on creation of the document, they are saved to the document, they look like “static text”..


                  bookmark_borderYOUFEB: YOUr FEedBack required

                  I wanna thank to all loyal readers of my blog. I know you’re out there somewhere…

                  Please get in contact with me.. write comments about my blogs, what you liked, in terms of content, in terms of writing style, what you didn’t like, what you missed.

                  Let me know who you are and what problems your dealing with…

                  I know most of you (besides maybe some 20 guys around the world) are struggling with the same issues than I have…

                  Have you ever wondered if it is possible to keep all code within a LN application in one place? Say ONLY in the java classes?

                  I believe the interface with drag&drop of fields, clicking on properties, entering attribute values etc. is great, but it’s also a GREAT pain!!!

                  Who of you has read my post about “do not copy and paste” stuff? Where an xPage wouldn’t behave, just because I copied and pasted and forgot to remove one of those “properties”…

                  I do envy those guys working with GWT.. they GUIs are so slick, so fast, so adaptable… and as far as I know they application runtime lifecycles are more easy to understand.

                  Or can you really tell me about the order of execution of all those “events”? Or when the first moment would be where you have a handle to the DominoDocument?

                  I do understand that most LN applications are just “little” adaptations of document mgmt templates, discussion templates etc.. but hey.. there are people out there really trying develop high-end applications, including workflows etc…

                  stay tuned for more questions answered from my side.. and tell me about your questions…

                  Michael

                  bookmark_borderQUINDIP: full source to display miniature flags in your apps

                  This is a real time saver for you… well.. it took me some hours to get the whole thing done and tested.. few flags might be missing in the css code and a few have not been verified, but most countries are handled.
                  Enjoy!
                  (full source code at the end of the blog)

                  This time we start with the result: You want to have country flags displayed somewhere, say in a type-ahead (see this post)

                  That’s the HTML source code:
                  <TABLE>
                            <TR>
                                 <TD><SPAN class=”FR”></SPAN</TD>
                                 <TD>FR</TD>
                                 <TD>FRANCE
                                      <SPAN>some company info</SPAN>
                                 </TD>
                            </TR>
                  </TABLE>

                  Here the file with flags from most countries in the world (you can download it)

                  here the css styles used to display the flags:

                  /* switzerland */
                  .CH{
                   display: inline-block;
                  background-image:url(‘flags.png’);
                  background-position: -200px -89px;
                  width: 11px;
                  height: 11px;
                  }

                  /* germany */
                  .DE{
                   display: inline-block;
                  background-image:url(‘flags.png’);
                  background-position: -284px -117px;
                  width: 16px;
                  height: 11px;
                  }

                  /* usa */
                  .US{
                   display: inline-block;
                  background-image:url(‘flags.png’);
                  background-position: -4px -565px;
                  width: 16px;
                  height: 11px;
                  }

                  resources available here

                  the updated css fixes a minor bug when adjacent rows are higher than the flag and other flags would be “displayed”

                  bookmark_borderFRULE: frustrated about stupid error messages

                  Scenario:
                  created xPage, added some fields, changed some properties, added custom control with buttons to save etc…, tried to create and save a “document” …
                  wouldn’t save…  wtf makes fun with me???

                  damn…

                  tried to find out what the problem was, got the idea to add an “display errors” control, guess what, there WAS an error!!

                  Search??? what search??? and WHERE?????

                  almost went nuts!!!

                  finally, you guess: after HOURS!!!, I had a brilliant or stupid idea: remove the form validations on “save” as the xPage wasn’t really “connected” to an existing form, and guess what!!

                  THE SEARCH ERROR MESSAGE DISAPPEARED!!!

                  Lesson learned:
                  1. xPages error messages are stupid as stupid can be
                  2. never use form validations if the xPage isn’t associated with an actual form

                  FRUstradedLearningExperience

                  I know.. usually all this wouldn’t happen when you start from scratch.. but as all lazy developers.. I sometimes “copy&paste” and this ain’t really helping sometimes!

                  bookmark_borderindip: use bean within another bean

                  I wanted to use a bean within another bean. And I wanted the most elegant way to achieve this.

                  Here’s what I got:

                  define the beans in the faces-config.xml as follows (notice the color codings, to show references!)

                    <managed-bean>
                      <managed-bean-name>childBean</managed-bean-name>
                      <managed-bean-class>com.abb.xpages.beans.ChildBean</managed-bean-class>
                      <managed-bean-scope>request</managed-bean-scope>
                    </managed-bean>
                     <managed-bean>
                      <managed-bean-name>ParentBean</managed-bean-name>
                      <managed-bean-class>com.abb.xpages.beans.ParentBean</managed-bean-class>
                      <managed-bean-scope>request</managed-bean-scope>
                           <managed-property>
                       <property-name>childBeanX</property-name>
                       <value>#{childBean}</value>
                     </managed-property>
                    </managed-bean>

                  then in your “parentBean” you “inject” the childBean as follows:

                  ChildBean childBean = null;
                  public void setChildBeanX(ChildBean bean){
                  childBean = bean;
                  }
                  then you can access the childBean in other places in your parentBean, 

                  Example method from the parentBean:
                  public String getColor(){
                  return childBean.getColor();
                  }

                  As always I hope someone might find this useful when struggling around with beans! Also check out my other recent post regarding scope setting if you require notes objects being serialized.

                  bookmark_borderquindip: problems with beans containing references to Notes objects?

                  I tried desperately to maintain references to Notes objects within a bean.

                  I always got a stupid error, either 500 or serialization error…

                  then I stumbled across this excellent article.

                  Solution Summary:
                  don’t use “view” for bean scope if you need to serialize notes objects! use session or request scope.

                  Stupid!!! really stupid!!!

                  but now I got my stuff working

                  Michael

                  bookmark_borderquindip: handle onKeyPress event server side (sort of ;-) )

                  Did you ever need to “catch” a key event? I did! Using the type-ahead feature i wanted to fill some fields depending on the selected value from the type-ahead field.

                  Now I used the “onBlur” event first. But that would require the user to move the focus away from the field with type-ahead.

                  I was looking for a solution where immediately after hitting <enter> the fields below would be filled.

                  Turns out this is pretty easy:

                  use two onKeyPress event handlers: one client-side, one server-side:

                  client-side:

                  if (thisEvent.keyCode==13) {
                        return true;
                  }else{
                        return false;
                  }

                  server-side:
                  call whatever functionality you need! in our case it’s a bean populating dependant fields


                  the client-side piece of code checks for <enter> and calls the server-side functionality only on <enter>

                  bookmark_bordermake sense of “flags” in your mail

                  Something about the mail template I don’t like: how colors are used.

                  they can be used to colorize mails from certain senders, I don’t see the point of it, i have the by Person view for that or I could use a rule to move emails from a particular group to a folder.

                  I would like to use colors for my “flagged” mails. Now you can, well you always could, maybe you simply didn’t know how. Let me explain it to you.

                  Create a form in a database. Add 3 color fields to it like this:

                  add a button with this formula:

                  Dim ws As New notesuiworkspace
                  Dim session As New notessession
                  Dim db As notesdatabase
                  Dim docProfile As notesdocument, docCurrent As notesdocument
                  Dim strformula As String
                  Set db = session.currentdatabase
                  Set docProfile = db.getprofiledocument( “colorprofile” )
                  Set docCurrent = ws.currentdocument.document
                  strFormula = {S_1B :=  “} + docCurrent.GetItemValue(“High”)(0) + {“; S_1F :=  “00000000”; S_2B :=  “} + docCurrent.GetItemValue(“Normal”)(0) + {“; S_2F :=  “00000000”; } _
                  + {S_3B :=  “} + docCurrent.GetItemValue(“Low”)(0) + {“; S_3F :=  “00000000”; } _
                  +{ color1 :=  S_1B   :   S_1F ; color2 :=  S_2B  : S_2F; color3 := S_3B  : S_3F; } _
                  +{ colorDefault := “FFFFFFFF” : “00000000”; } _
                  + { @if( “1” = FollowUpStatus ; color1; “2” = FollowUpStatus ; color2; “3”  = FollowUpStatus ; color3; “” ) }
                  Call docProfile.replaceitemvalue( “$Sender1”, strFormula )
                  Call docProfile.save( True, True )
                  Print “Chosen colors for flags have been set”

                  Send the form to yourself (maybe with a button and a formula like this):

                  Dim ws As New notesuiworkspace
                  Dim session As New notessession
                  Dim db As notesdatabase
                  Dim docCurrent As notesdocument

                  Set db = session.currentdatabase
                  Set docCurrent = ws.currentdocument.document
                  Call docCurrent.replaceitemvalue(“Subject”, “Use colors for flagged mails” )
                  Call docCurrent.ReplaceItemValue(“Form”, “frmMailColors” )
                  Call docCurrent.Send( True )

                  I guess the rest you should figure out yourself how it works. I posted this tip on our intranet yesterday and got immediately tremendous feedback. Well I didn’t go into details, I just let our users know their mail could look like this: (notice the little flag icons and how the whole mail changed it’s color! Now the “flags” for mails finally make sense!)