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="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">
...