New functionality was added in Notes 8.5.1 to make MyWidgets more dynamic

In Lotus Notes 8.5.1 a small, but very useful, addition was made made to the MyWidgets funtionality. From Notes 8.5.1 the preferences that you specify for your widgets may be computed by the platform instead of being mapped to something you specify via LiveText or text selection. Below is a small snippet from an extension.ml file showing how a value is normally mapped to a parameter (in this case “Mikkel Flindt Heisterberg” is mapped to the “name” parameter).

<preference name="name">
<value>Mikkel Flindt Heisterberg</value>
<displayName>name</displayName>
<enumValues/>
<enumDisplayValues/>
<datatype></datatype>
<isEnum>false</isEnum>
<isRequired>true</isRequired>
<isHidden>false</isHidden>
</preference>

So what if you want to use the current username or the current date? Well up to now you were at a loss or you had to incorporate the functionality into the service you linked to. But since this isn’t always possible IBM added the option of specifying it in the widget itself.

The way to do it is by using a “name” or “date” command in place of the static text (“Mikkel Flindt Heisterberg” in the example above). The syntax is as follows:

${command:parameter}

The following two commands are available:

  • name
  • date

As you might be to format the date or specify the part of the username you need (common name, organization etc.) you use “parameter” part to further instruct the command. Below is some documentation on each of the commands.

  • ${name:nameType}
    For example: ${name:cn}/${name:ou}/${name:o} will resolve to “CommonName/OrganizationlUnit/Organization.” For example: ${name:dn} will resolve to the user’s full distinguished name.
  • ${date:dateformat}
    For example: ${date:yyyy MM DD} will resolve to the current date (in this example “2009 03 20”). The “dateFormat” should be a valid Java date format string.

Using the “name” command the above XML snippet becomes:

<preference name="name">
<value>${name:cn}</value>
<displayName>name</displayName>
<enumValues/>
<enumDisplayValues/>
<datatype></datatype>
<isEnum>false</isEnum>
<isRequired>true</isRequired>
<isHidden>false</isHidden>
</preference>

Information is available in the infocenter (Using a widget property to filter a current user name or date)