Tag Archives: Custom Controls

Use the same datasource everywhere in XPages

When using custom controls there are several ways of binding fields to backend fields.

1. Create a datasource with the same name as the datasource you are using for the fields

(Warning! if you forgett to remove this when you are done you will get a replica conflict)


2. Pass the Datasource into the custom control and use the compositeData.propertyname[“fieldname”] to bind to the field. This article describes how to do this –>Link


3. Use a save function and retrieve the values from the fields and save the information to fields. This would also require a load function to populate the fields.

And there are probably several more ways of doing this, that is often the problem with XPages you get multiple ways of doing things and you don’t know the right way.

If often use number 1 when I’m creating xpages, the problem with this way is that if you have to add a new fields later you have to add the datasource again if you would like to use the simple binding dialog.

But there is another way, add a datasource with the variable name and properties as you main datasource. Go into source mode and add loaded=”false” to the data sources on you custom controls, you can still use the simple data binding and you will not get any replica save conflicts because this datasource isn’t loaded.

This is what you source should look: 

Hope this will help you get rid of some annoying replica conflict when you have forgotten to remove a datasource. Enjoy!