Customizing IBM Connections Profiles – Add custom field to searchResults

Adding a custom field to IBM Connections Profiles is great documented in “SHOW301: Make Your IBM® Connections Deployment Your Own: Customize It!” the Connect 2014 session of Wannes Rams and Klaus Bild. Thanks to them for this great collection of customizing tipps.

In my case the bundle name is “stoeps” and the custom field i want to add is “twitterId”.

lotusconnections-config.xml

<resources>
    <!-- Custom strings for field labels --> 
    <widgetBundle name="local.stoeps.profiles.strings.uiLabels" prefix="stoeps"/>
</resources>

local.stoeps.profiles.strings.uilabels.properties

# extension property field labels
label.stoeps.twitterId=Twitter Id:

profiles-types.xml

<property>
   <!-- Custom field for Twitter ID -->
   <ref>twitterId</ref>
   <updatability>readwrite</updatability>
   <hidden>false</hidden>
</property>  

profiles-config.xml

Checkout profiles-config.xml and change following points:

<profileDataModels>
    <profileExtensionAttributes>
    ...
        <simpleAttribute extensionId="twitterId" length="180 />
    </profileExtensionAttributes>
</profileDataModels>

Uncomment the extensions templateData:

<template name="businessCardInfo">
  <templateDataModel>
        <!--  include if you render workLocation, organization, department information -->
        <templateData>codes</templateData>
        <!--  include if any only if you render profile extension fields in the template -->
        <templateData>extensions</templateData><!-- activated for twitterId in searchResult -->
        <!--  include if you render secretary name or email in the template -->
        <!--   <templateData>secretary</templateData> -->
        <!--  include if you render manager name or email in the template -->
        <!--  <templateData>manager</templateData> -->  
        <!--  include if you render information dependent upon two users being connected -->
        <!--  <templateData>connection</templateData> -->               
  </templateDataModel>
</template>
<template name="searchResults">
  <templateDataModel>
        <!--  include if you render workLocation, organization, department information -->
        <templateData>codes</templateData>
        <!--  include if any only if you render profile extension fields in the template -->
        <templateData>extensions</templateData><!-- activated for twitterId in searchResult -->
        <!--  include if you render secretary name or email in the template -->
        <!--   <templateData>secretary</templateData> -->
        <!--  include if you render manager name or email in the template -->
        <!--  <templateData>manager</templateData> -->                  
  </templateDataModel>            
</template>
...
<searchLayout>
...     
<!-- custom field in searchResult -->
<extensionAttribute showLabel="false" labelKey="label.stoeps.twitterId" bundleIdRef="stoeps" extensionIdRef="twitterId"/>
</searchLayout>

Now you must add following line to :

profilesEdit.ftl

I added following line within <@util.renderSection sectionLabel=”contactInformation”>:

<@util.renderFormControl ref="twitterId" singleColumnLayout=false nlsBundle="stoeps" nlsKey="label.stoeps.twitterId"/>

profilesDetails.ftl

<#-- Customize start -->
<#-- Adding a field twitter id -->
<@util.renderProperty ref="twitterId" nlsKey="label.stoeps.twitterId" nlsBundle="stoeps" hideIfEmpty=true ;  ref, dataId, dataKey, nlsKey, nlsBundle>
    <@util.renderValue ref=ref renderAs="twitter" />            
        <br/>
</@util.renderProperty>     

<#– Customize end –>

searchResults.ftl

I added following code above the renderProperty of jobResp:

<@util.renderProperty ref="twitterId" nlsKey="label.stoeps.twitterId" nlsBundle="stoeps" hideIfEmpty=true ;  ref, dataId, dataKey, nlsKey, nlsBundle>        
    <div>
         <@util.renderValue ref=ref renderAs="twitter"/>
    </strong>   
    </div>
</@util.renderProperty> 

renderAs comes from commonUtil.ftl, to format a URL to the Twitter Homepage.

commonUtil.ftl

...
<#elseif renderAs = "email">
    <a href="mailto:${value}">${value}</a>
<#-- customize start -->
<#elseif renderAs = "twitter">
    <#-- special rendering for twitter id -->
    <a href="http://twitter.com/${value}" target="_new">@${value}</a>       
<#-- customize end -->
<#elseif renderAs = "blogUrl">
...

Result:

search result

Selection_20140415_11:28:28_001

Profile

Selection_20140415_11:37:41_001

2 thoughts on “Customizing IBM Connections Profiles – Add custom field to searchResults


  1. Hi Christoph,
    this is a very useful post for me, because I’m working on LC customization too…
    Actually, I can’t obtain the same result, even with a simple editing of the Profile HTML in
    profilesDetails.ftl…
    Can’t see any difference atm, maybe it’s just because I need to use wsadmin and checkout/checkin + AppServer restart in every change I make?
    In Connections Wiki it seemed to be necessary, reading your guide I hoped I could avoid it,
    just to make quick tests…
    Any suggestions about?


Comments are closed.