Customizing IBM Connections Profiles – Add custom field to searchResults

Created:
Last Update:

Author: Christoph Stoettner
Read in about 2 min · 419 words

Fountain pen and a notebook

Photo by Aaron Burden | Unsplash

Adding a custom field to IBM Connections Profiles is great documented in “https://www.slideshare.net/palmke/show301-make-your-ibm-connections-deployment-your-own-customize-it-30628456[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="ma&#105;l&#116;&#111;&#58;&#36;&#123;&#118;&#97;lue&#125;">${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 112828 001

Profile

Selection 20140415 113741 001

Author
Add a comment
Error
There was an error sending your comment, please try again.
Thank you!
Your comment has been submitted and will be published once it has been approved.

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

Suggested Reading
Aaron Burden: Fountain pen and a notebook
Last week i searched a way to send all Connections users an information on important updates, which should be configurable and uses cookies to hide it for a specific time. First i had a look at the Greenhouse Announcement Widget which is used within Greenhouse . Quite nice, but i had problems with IE 9 users and the popup appears on each page you open within Connections. So i tried something other. After some searching i found a script of Ollie Phillips which is originally used to inform users about Cookie usage on the site. Ollie published the cookiesDirective.js under the MIT License.
Created:
Last Update:
Read in about 2 min
Card image cap
I have read about a new function in IBM Connections Wiki, which I missed until now. A new macro to create a table of contents within a wiki page. The activation of this macro is documented here: Wikis configuration properties wikimacros.enabled Specifies whether macros are enabled in Wikis. You can use macros to automate common tasks, such as generating a table of contents in a wiki page. The default value of this parameter is false. To enable macros, set the value to true. When enabled, macros are available from the Macros menu in the editor toolbar. Documentation I’m a little confused (the config option should be editor.
Created:
Last Update:
Read in about 3 min
Aaron Burden: Fountain pen and a notebook
I had a problem last week with some customizations via custom.css in IBM Connections 3.0.1.1 CR3. Communities still use the default Layout and colors. I found that defaultTheme.css rewrites some of my custom.css statements. I had to add the content of custom.css to the end of the xxxTheme.css (lazy but it works), that i have a consistent color and layout change. Tests with @import are not working, because @import must be the first statement of a css file and i need to add the custom.css to the end of the xxxTheme.css.
Created:
Last Update:
Read in about 1 min