I was given a task to list down all controls and theirs labels along with some other attributes like style, style class, parent id, etc and prepare an Excel sheet. It was so boring and tedious task for me. This is a repetitive task in which I need to copy attributes value and paste it to the Excel sheet. I decided to automate this task and wrote this piece of code which simplifies my task drastically.

Paste above code in the script library and following code in afterPageLoad event of XPage

Now preview your XPage into the browser. A list of documents has been created in the application with form name fDoc. Create a view to display all these documents and its field values.

2 thoughts on “Documentation

  1. getType() would benefit from less elseIf 🙂
    Why not use a JSON object to keep your classname/label relations, so you can extend it easily when adding new classes. Something like:
    knownControls = {
    “” : “Repeat Control”,
    “” : “Pager”,


    what also might make sense is to document parent
    (and eventually grandparent).

    1. Hi Stephan,
      First of all I would like to thank you for your valueable comment.
      I do agree with your suggestion but at the time of writing of above code I was not aware about JSON objects.

Leave a Reply

Your email address will not be published. Required fields are marked *