Adding a GDPR message to my XPages app

GDPR or Cookies plugins are nothing new. A simple search will give you a quick overview which jQuery based plugins are available.

So I decided the one that looked nicest to me and implemented it my XPages app. It worked but not when I met a user who was using IE. No JS error or whatever so where to start debugging? ūüė¶

When looking in the original code I noticed that a different version of jQuery was used than is available on or Domino V10 server. So I posted an idea for an upgrade on the HCL Products Ideas Portal.

In the end I tried the Customizable EU Cookie Notice Popup Plugin which uses the 2.1.1 version of jQuery which is the same version as on the Domino server. (Loading multiple versions jQuery makes Dojo complain).

But then the requirements of the project changes and the functionality should become more to highlight news or updates within the application so I had to add some additional functionality:

  • enable / disable news display/popup
  • option to steer location / appearance on screen
  • from / until dates, so a period when the message should be displayed.

I decided when the option to enable the display but leave the from and until dates empty the popup will be displayed as long as the session of the browser lasts.

So these settings are stored in a Notes – Configuration document and made available as session scope variables.

Also the content of the popup has to be easily editable so for this I use Notes – Keywords documents so I can have messages in multiple languages.

When the code was working I lifted it up into a custom control which I can now re-use across other applications. Not that the custom control contains custom properties (yet)

undefined

The function to set the cookie expiry date is as followed:

To set a java date in a scope variable can be a little tricky. I did it as follow:

But this is all the code I needed. The result is as followed:

Note: I have altered the JS file of the plugin to bootstrap it more and to make it responsive.

When I press the OK button a cookie is set that last a browser session (I left the from and until dates empty in my settings):


If you like this post then please support my idea for upgrading the jQuery version on Domino: https://domino-ideas.hcltechsw.com/ideas/DDXP-I-637

Happy development ūüôā

Fiddling with jax-rs and getting frustrated

Today was probably not the best day for development. After getting the Jakarta EE project to work on the development server by a miraculous second signing of the plugins in the update site NSF and restart of HTTP on Domino (v10) my next step was to actually getting to get some code running.

Curious as I am I found some code samples here , here and here but after trying some of the samples in my NSF I keep on running on errors:

[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM: ERROR i18n RESTEASY002025: Unknown exception while executing GET /sample/counter
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM: org.jboss.weld.exceptions.AmbiguousResolutionException: WELD-001318: Cannot resolve an ambiguous dependency between: 
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:   - Managed Bean [class servlet.Sample] with qualifiers [@Any @Default],
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:   - Managed Bean [class servlet.Sample] with qualifiers [@Any @Default]
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.weld.manager.BeanManagerImpl.resolve(BeanManagerImpl.java:1164)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:66)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:73)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.createResource(POJOResourceFactory.java:67)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:309)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:439)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher$$Lambda$95.0000000046F8EF20.run(Unknown Source)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher$$Lambda$96.0000000046F8F8D0.get(Unknown Source)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:355)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.openntf.xsp.jaxrs.impl.FacesJAXRSServletContainer.service(FacesJAXRSServletContainer.java:96)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:600)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1352)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:877)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:820)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:589)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1336)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM: org.jboss.resteasy.spi.UnhandledException: org.jboss.weld.exceptions.AmbiguousResolutionException: WELD-001318: Cannot resolve an ambiguous dependency between: 
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:   - Managed Bean [class servlet.Sample] with qualifiers [@Any @Default],
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:   - Managed Bean [class servlet.Sample] with qualifiers [@Any @Default]
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:257)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:193)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:455)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher$$Lambda$95.0000000046F8EF20.run(Unknown Source)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher$$Lambda$96.0000000046F8F8D0.get(Unknown Source)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:355)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.openntf.xsp.jaxrs.impl.FacesJAXRSServletContainer.service(FacesJAXRSServletContainer.java:96)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:600)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1352)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:877)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:820)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:589)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1336)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:357)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:313)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM: Caused by: 
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM: org.jboss.weld.exceptions.AmbiguousResolutionException: WELD-001318: Cannot resolve an ambiguous dependency between: 
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:   - Managed Bean [class servlet.Sample] with qualifiers [@Any @Default],
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:   - Managed Bean [class servlet.Sample] with qualifiers [@Any @Default]
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.weld.manager.BeanManagerImpl.resolve(BeanManagerImpl.java:1164)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:66)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:73)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.createResource(POJOResourceFactory.java:67)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:309)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:439)
[14EC:0011-0484] 2020-02-12 21:24:57   HTTP JVM:  ... 23 more

Here is the code that I am running:

Workaround for updating the styleClass property of a button when using BS theme

In my application I am using the Bootstrap theme that comes with the extension library. In the application I have a button with which I want to enable/disable the appearance of the debugtoolbar plugin for the end-user so it will be easier to handle incident reports when they should occur.

So in my application layout control I added the toolbar and compute the appearance:

debuglayout

Now somewhere in my application I have in a dialog a button to show/hide the debug toolbar:

debugBtn In the browser it looks as followed:

debugDlg

At first when I pressed the button the styleClass would update ONLY when I totally refreshed the page which was undesired.

The trick here is to disable the theme for the button:

debugTheme

I then have to surround the button with additional HTML span element:

<span class=”btn-group”><xp:button…/></span>

As a result the button changes styleClass correctly:

debugSwinging.JPG

Want to know more about XPages dev item? Just drop a question below…

DominoJam – The need for an appstore

With a couple of days left to a DominoJam here in Stockholm  was thinking what I think is really desired (perhaps needed) at the moment for development in IBM Notes.

Perhaps besides a stable and enhanced Domino Designer (hint) I would probably benefit most from a real appstore for Domino. With appstore I mean some sort of updatesite provided by IBM.

We all use the extension library in some form, if it the version that is shipped with the Domino server in form of an feature pack or a version that is available via OpenNTF.

Can you imagine starting a project WITHOUT that library nowadays? So this is a practical example of something that is good ON TOP of the Domino server when using it as an APPLICATION DEVELOPMENT platform, so MORE THAN JUST EMAIL.

In the beginning I heard several administrators and hosting companies (including IBM) complaining that they was no guarantee on the library. Well I do not know how many crashed servers you have had due to that extension but I can not remember a single one.

So if IBM would somehow guarantee the quality of plugins on that appstore (do some quality- & security checks and some code review) and there is hardly no argument for administrators not to install of plugins from that appstore (in Production).

An easy install from the Domino console (similar to npm – install) and voila! a plugin is installed. For paid plugins you should provide somehow a registered IBM account (you know how to bill us).

It would also could make Domino more attractive to developers if plugins could become available with a reasonable price (you do the suggestion here).

I do not think that the amount of plugins on the appstore will so overwhelming (lost opportunity?/not the most important) but at least the threshold to have the ability to extend the Domino server for your development projects is much less.

Good initial candidates for the store are:

My apologies if there are OpenNTF projects that I have been using during the years and do not appear in my list. Perhaps some projects could be split up in several projects with dependencies.

My goal would be a quicker, easier, latest (update) installment of stable and secure plugins and perhaps a wider range of offerings. This would enable me to quicker adapt new technologies and perhaps trigger myself to learn how to write an extension one day.

Ending with an adapted famous movie quote:

All right, plugins, plugins, plugins! Come on in plugin lovers! Here at the Titty Twister we’re slashing plugins in half! Give us an offer on our vast selection of plugins, this is a plugin blow out! All right, we got white plugin, black plugin, Spanish plugin, yellow plugin, we got hot plugin, cold plugin, we got wet plugin, we got smelly plugin, we got hairy plugin, bloody plugin, we got snappin’ plugin, we got silk plugin, velvet plugin, Naugahyde plugin, we even got horse plugin, dog plugin, chicken plugin! Come on, you want plugins, come on in, plugin lovers! If we don’t got it, you don’t want it! Come on in, plugin lovers!

 

Or more decent (from a colleague) :

When you roast old bread it becomes tasteful again.

Happy DominoJam ūüôā

A happy camper?

A day lost due to DDE incapabilities

Today I lost a complete development day due to errors related to DDE. After building a project I constantly get errors as followed:

HTTP JVM: com.ibm.xsp.webapp.FacesServlet$ExtendedServletException: javax.faces.el.EvaluationException: java.util.MissingResourceException: Can’t find resource for bundle java.util.PropertyResourceBundle, key strings

and:

HTTP JVM: java.lang.SecurityException: Error verifying signature for resource WEB-INF/classes/se/acme/namis/app/Application.class. For more detailed information, please consult error-log-0.xml located in E:/IBM/Domino/data/domino/workspace/logs

The way I am forced to work now is to clean the project, build the project, sign the complete database, PRAY.

Is there no way to build an XPages project OUTSIDE of DDE?

This is no workable way of developing anymore.

XPexit?

Passing a SSJS function to a custom control

Introduction

I am building a custom control that mimics the viewPanel control but it is a repeat control which data is not a view but a managed bean that returns an arraylist of java objects (representing Notes documents).

I am using a Bootstrap table for display I in a previous post I have demonstrated how I can provide a JSON object to have flexibility in the columns I want to display and the values I want to display.

Next step is the option to provide custom actions to the custom control, in a way that the code under an action button in the custom control is provided via a property. So in one case hitting the button could print all selected documents, in the other case it could remove all documents from the database.

Step 1 – Creating an arraylist of unid’s

Key here is that I have an arraylist of unid’s to work with. The technique how to select documents in a repeat control was demonstrated by David Leedy in Notes in 9 episode 25. Instead of buttons I use a checkboxgroup:

So now I want from my xp:button in my custom control do something with this arraylist of unid’s…

Step 2 – set up the property definition

Next step is to setup the property in the property definition of the custom control:

Not the most common type of class and editor you use for a property.

Step 3 – setup the event handler for the button

In order to have the button to understand that the action to be performed is coming from a action property we need to specify that in the onClick event:

(Note: my property resides in the group property actionButton)

Step 4 Рset up the SSJS  function you want to run

So now our button knows it’a action comes from a propert we need to write the SSJS function for the button. I have placed it in a SSJS script library. Here is an example to remove documents from a database:

Step 5 – Add the SSJS to the property

The last step is the most tricky one. In the property you are not allwed to provide any parameters or parentheses for the SSJS function. So our action property becomes as followed:

Result

As a result I have the following UI:

  • A custom control with a button which onClick action is provided via a property on that host xpage.

IBM Champion Nomination

Is this blog-article useful to you? Perhaps you can nominate me as IBM Champion.

XPages sufficient for line of business type of applications?

Hi there, currently I am following another Angular course since it seems to have become the leading development framework at work. So back to learning all the rules within Angular.

At the moment I am modernizing a Domino application with the help of XPages which:

  1. Implements Model-View-Controller architecture, mostly inspired by the guys at Pipelia since IBM never told us to do so.
  2. Is written in Java to support the MVC architecture and to have close integration with XPages runtime.
  3. Is using Expression Language wherever possible to avoid usage of SSJS.
  4. Uses the lifecycle of JSF in XPages at the max.
  5. To cover support for different devices I am using Bootstrap as front-end framework. So I miss some native behavior which I do not tend to cover-up.

So far so good and I think I have come quiet long in my project so I still dare to call it rapid application development.

The code-base has been reduced dramatically and all exotic upcoming JavaScript libraries from the early 2000 I have been able to replace with just XPages.¬†With my latent UX skills and extending the out of the box Bootstrap I might now even call this application ‘sexy’ ūüôā

I know I haven’t touched many areas discussed in the XPages community such as:

  • Websockets (I do not see a use-case yet).
  • Writing Java servlets (please pass me a demo NSF).
  • Watson services (cloud is still a sensitive topic).
  • set up micro-services with smartNSF and consume them in my Java code with an mapper library (requires changes in the environment).
  • Integration with IBM Connections.
  • Redefining my data with the help of a Graph DB.

Either I see little usage, it is not possible or there is no-one to guide me (the information is certainly not provided by the vendor).

So now back to Angular. Learning all these rules, technologies and new tools setup I was wondering what new technical options this framework will bring me at work. Reflecting on the type of customer-orders I receive I am wondering:

Is XPages not sufficient for most of your line of business apps?

Perhaps you have a though about this?

Happy development & enjoy your summer ūüôā

Display JSON pretty in a textarea control

In an application I am using heavily JSON default as the data-format. To make debugging a bit more easy I am working on a toolbar to be able to check the content of the JSON objects.

Normally I use JSONLint most of the time to prettify (and validate) the JSON so it becomes a bit easier to read and check. But this copy and paste habit becomes more and more obnoxious so there I wanted to have a toolbar (like the debug toolbar) to have a good overview of the JSON objects.

However if you write the JSON object to a computed field or text area field (inputTextarea control in the XPages world) it is just plain, unformatted text. Not pretty for the eye and not much helpful for the brain.

So I tested a simple approach which turns out to run just fine. I display the json object in a textarea input control and then with CSJS I format the content. Here is some sample code:

<xp:inputTextarea id=”input-fieldx” defaultValue=”#{javascript:App.currCollection}”>
</xp:inputTextarea>
<xp:button value=”Make Pretty” id=”button1″>
<xp:eventHandler event=”onclick” submit=”false”>
<xp:this.script>
<![CDATA[var name = x$(‘#{id:input-fieldx}’).attr(“name”);
prettyPrint(name);]]>
</xp:this.script>
</xp:eventHandler>
</xp:button>
<xp:scriptBlock id=”scriptBlock1″>
<xp:this.value>
<![CDATA[function prettyPrint(id) {
var obj = dojo.byId(id);
var ugly = obj.value;
var json = dojo.fromJson(ugly);
var pretty = JSON.stringify(json, undefined, 4);
obj.innerHTML = pretty;
dojo.setAttr(id,”rows”,10);
}]]>
</xp:this.value>
</xp:scriptBlock>

Here is what it looks like:

json-before

The content how it looks initially.

json-after

The content how it looks like after running the code.

Note I had to include the [ ] signs in my code to make the JSON valid due to circumstances in my code, I removed it from the sample code above.

At least now I understand my JSON objects again and I can avoid some copy and paste to JSONLint ūüôā

This is probably my last blog of this year so I would like to wish you some wonderful Christmas days. Take care and best wishes for a healthy 2017!

 

 

Adventurer

I have always known that I am an adventurer. My Lotus/IBM Notes career started as a adventure into an¬†international professional working-experience and the people who know me will probably say that it will be very hard to make¬†an ordinary “9 to 5” office guy out of me.

I could never resist the call of the trail – Buffalo Bill

So far about me as person. The occasion of this post are several calls in the community to take a look at Salesforce as an application development platform.

So I took the time to take a look at it to find out if it would be of interest of me. As suggested my journey started with Trailhead. My journey, so far has lead me to finish the developer beginner trail.

I will write about my first experience and will not do any comparison, simply because my knowledge on Salesforce is limited to do so.

If you read this trail description it tells you it will take you up to 15 hrs and 45 minutes. Well I can tell you: it took me much more time. There is a LOT¬†of text to read, video’s are ¬†included and there are challenges to complete modules and to earn points for badges. A challenge can be a list of questions or an exercise.

So let’s assume all the effort and time-investment does contribute to your understanding of the platform.

Before starting, a couple of developers told me about the similarities with Notes and XPages and I have to say it is nice to recognize that building XPages applications have brought Notes developers closer to genuine application development (as far as it compared with Salesforce).

Salesforce biggest ugliness at start is of course it is not NonSQL as Notes is.

A nice feature is Salesforce web enabled development interface. I have not come to the Eclipse IDE yet. I have used the classic web interface, since in Trailhead the examples and screenshots are from the classic interface. I can not say I am in love with a web interface since I noticed some genuine lags compared to the XPages IDE (autocomplete for example). Also getting into read mode after performing a save action I found annoying.

I admit there are similarities programming in Salesforce compared to Notes and XPages, but I guess this comparison is similar with other programming languages. When it regards to building custom user interfaces Visualforce reminds me a lot about XPages.

So after completing this first trail I find the learning curve not that steep. Using Trailhead is just very time-consuming. An instructor or video-learning would have been much more time efficient. But¬†if you want to gain some deep knowledge it doesn’t hurt to spend time on the approach.

A quote I heard is that Salesforce is the platform Notes should have been (if IBM would have prioritized it more) and that there are many more goodies to be found in the trail¬†Develop for Lightning Experience¬†so I am looking forward to take another hike. Ofcourse with my newly earned Adventurer badge on my backpack ūüôā