Wednesday, April 21, 2010

My escapades in Xpages in which I ...code? sorta

This is for all the admins and developers who have yet to work with XPages.

Many readers know I am not a developer, although decades ago I was. You may recall this post which was highly popular at the time when I discussed how hard it was to code in Designer 8.5 or I should say what worked or didn't work for me.

At the time I did not even touch XPages.

My how times change, we still do not employ a developer in house, we hire as project requires, so guess who gets to play developer!

So for our LCTY's I needed a database for registration and information setup, easy I say, I got some hundred templates and stuff, must be something I could reuse. Famous last words!

If you have been following me on Twitter, you will know I have been playing with PHP usage and Domino(post coming if/when I get it working) and the last few days providing excellent humor to the greater community, right Darren, while I query basic items that should be simple to do in the Designer client but are nowhere to be found.

I asked around, not with much luck, and some cryptic coding references. Chris Toohey Blogger of the Year for his great efforts, was helpful in 2 key points which made a world of difference for me.

But let's start simple.

1) Getting started page of Designer which most people click away has some basic, really basic information. You can see it by clicking on help from Designer and Click on Welcome.

2) From the Welcome screen, now click on What's New. Scroll down to Learn more and you will seek the "howto" for XPages from the help. So click on XPages Tutorial which takes you to the Help guide and the XPages tutorial, which for me was not written for a new developer. If I had more time I would have followed it all, but I learn on the fly and by necessity. Don't follow me, follow the tutorial, it is pretty good with pictures and details, although you would be better served if you were a developer already IMHO.

3) Now, if you are with me this far, I suggest you take a look at some blog posts from David Leedy that helped me with some basics that I was missing. Thanks again David!

4) If you have any interest in XPages, you must start with Declan Lynch's (definitive?) blog posts on XPages, not as helpful for me short term this time but great references.

5) Chris Toohey pointed out some items which a new developer might not know and that is you may not see your control sets or data in the right hand column of your Designer client. Control sets provide the great drop down of all the items available for usage which we all know and love like checkbox, fields, links, radio buttons. This is important because they are drag and drop and easy to use, if you know hwo to work with them. And the second reason this column is important is because once you create your Notes regular form and fields, there is a 2nd tab for data which once you tell it where to find the details allows you to drag and drop all the fields onto your new XPages form. And they are done. So cool! But for whatever reason they did not show up on my screen. To see it, when you have your application/database open in Designer go to Window on the Menu bar and then Reset Perspective and click Yes when it asks to reset to defaults. Later on you will understand more about it, if you stick with this.

So that's the basics. Perhaps in another post I will detail how i put the site together. Suffice it to say I used a mix of html pages and a notes app.

Now, what were my problems?

1) RTFM applies to me in this case, but since there is no really good manual or help file that lets me ask in normal English what is in Eclipse/XPages language this caused me some issues.

2) Emailing your form/document. Prime example of my queries that went nowhere, as I just said in #1. Nothing to explain how to do this, no control set either. You have to build it. Bad, I say, just Bad. You can have a control for links but not a mailto option type control? I chalk this one up to my lack of education but if you can "submit" a form, you should be able to have the option to submit and email.

3) Lots of options for everything, but if you don't get your data linked properly, it won't work. Error reporting, even when enabled, leaves a lot to be desired.

4) XML is not HTML. Fine I accept that. But provide a basic, here is how you would add something in html and this is what it looks like in XML. Note the changes, now go code. I found some sites on the net that helped but don't have the links. Sorry.

5) I might be out of line here, but a default view should be created on the fly with whatever information is in one's form (notes or XPages). Ok, maybe this is just a dream, but why do I still have to create a basic view like I did 20 years ago? By hand?!

Eventually I did manage to get the XML side a little and edit in the source page to fix some things. But if you never coded html or understand how to read code, you may find yourself confused at first.

A great learning experience and makes me want to understand more about XPages and see the fruits of my labor more often, but I also know I am really not a developer, and never claim to be one.

Bottom line is yes you can build it, if you have patience, time, the internet, books, manuals and great friends to help you online, IM, skype, phone or email.


  1. Thank you, thank you.... I spent an hour this morning trying to find where the core control choices were hidden...just about to pitch the computer out the window... when along comes your post that told me exactly how to expose them for my use. sure didn't find this in the help documentation... maybe its there somewhere.

  2. Keith,

    Interesting post. Glad to see you at least dip your toes into the XPages water...

    A couple of comments.

    I'm not sure I understand point 5...
    You still need forms and views. Just like a relational database - you need to "define your table" and forms serve that purpose. The views act like "queries" for your data lookups. So those are two design elements that you still need to start with really.

    As for the using HTML inside the XML source.. I did a little demo on this regarding adding html fieldsets directly to the XML

    Regarding your submit button issue. I assume that you have a button that uses the simple action "Save Data Sources" or something similar. One of the neat things is that you can chain simple actions. So you could add a simple action for "Execute Code".

    Of course the difficult part is how to you enter the code? Well it's Server Side JavaScript. But really it's a "hybrid". You can use most of the backend domino objects that developers live on but you can also use many of the @Formulas which are easier to deal with sometimes. But alas something as simple as @MailSend isn't available unfortunately. All I can say here is that if a developer can use LotusScript to send a mail like/message - it's really not that difficult to do with SSJS since the same backend objects are available....

    off the UNTESTED Top of my head I'd think something along the lines of:


    Where document1 is the name of your bound document.... And I guess you have a SendTo field on your document... There's a bunch of send methods - you could maybe do

    document1.send(false, "Keith Brooks")

    again not sure - don't have anything in front of me but maybe it's a starting point for you.

  3. @John you are welcome and man did it save my butt to see those too! Thanks to Chris.

    @david, I do understand what you are saying, but it is the coding that gets in the way. So in this case, where/how do I add the code you posted?
    See it's the little things which advanced developers forget when explaining their posts to those of us with no background.

    Oh and my point in #5 was why do I have to build a basic view, it should just be setup. More advanced views I understand coding.
    Like I said, it's probably just me.

  4. Keith, we have a free Intro. to Domino Designer course that has a nice module on using XPages.


  5. Cool, thanks Howard will check it out.