Monday, June 23, 2008

Add Tagging To Your Mail (Or Any Other Application) Without Design Changes!

If you'd like to find out how to add simple tagging capabilities to your Lotus Notes applications without making any design changes, then keep reading...

As a way to increase my productivity in processing e-mail, I stopped using folders for filing a few years ago. This is especially easy in Lotus Notes 8, since the search capabilities are much nicer and have been enhanced in such a way as to make me very happy I made this choice. Basically, when I process e-mail, I determine if the message is actionable and if so, I decide what to do with it and then remove it from the inbox. I don't file it in a folder...I just choose the "Remove from Folder" action. Clean, simple and gets the job done. I did find, however, that quite often the text that is included in the e-mail does not contain the actual meta data that I would later want to search on. Thus, I found myself editing messages and adding the key phrases related to the e-mail before I removed them. Of course, what I was doing is known by most people as tagging and I realized that a simple mechanism for tagging is exactly what I wanted.

In my last job, I had a highly modified mail file that I used for my GTD system as well as for other productivity enhancements (and as a playground for off the wall ideas, I must confess). When I came into the tech sales role at IBM, I decided early on that I should use the generic mail template, since I would be doing so many demos for customers. As a result, my initial tagging mechanism had to morph to something that required no design changes. I thought that whatever I came up with should be useful for others, but didn't want to spend the time building a complete solution in another NSF. So, I decided to see if I could utilize Formula language in a custom toolbar button. The result, while not elegant by any means, is quite efficient and works well for me, so I thought I'd throw it out here to share.

Here's the scenario. I select the document in question and click my "Tag It" toolbar button. To allow for choices from tags I've already used (for continuity and best search results), I pull up a dialog box of previous tags and also allow new tags to be added. Once I have the necessary tags for the document selected, they are saved into a new field on the document. That's pretty much all there is to it from a user point of view. Here are a couple of screen shots to illustrate:




In order to make this work on a per application basis, I save the list of tags used in a profile document. The first line of the code pulls up the list of previously used tags, while the second line retrieves any of the tags that might already be assigned to the selected document. The next few lines provide for a multi-list dialog, along with logic that checks for the selection of "-add new-". If the "-add new-" option is chosen, the user is prompted to enter new tags (separated by commas) and the updated list of selected tags and any newly entered tags are written to the "txt_CustomTags" field. Finally, the last line makes sure any new tag values are written back to the profile document for use next time.

REM {Get tags stored in database};
Tags := @GetProfileField("TagsProfile";"txt_CurrentTags";@UserName);


REM
{Get any tags from the selected document};
DocTags := txt_CustomTags;

Selection := @Prompt([OkCancelListMult]; "Select Tag(s)"; "Please select the tag(s) to apply to this document"; DocTags; @Trim("-add new-" : @Unique(Tags : DocTags)));

@If(Selection = 1;
  @Return("");
@IsMember("-add new-"; Selection);
  @Set("NewTag"; @Prompt([OkCancelEdit]; "Enter New Tag"; "Please enter the new tag(s) you would like to apply to this document. Separate tags with a comma"; ""));
  "");

UpdatedList := @Trim(@Unique(@Replace(Selection; "-add new-"; "") : @Explode(NewTag,"," )));


FIELD
txt_CustomTags := UpdatedList;

@SetProfileField("TagsProfile"; "txt_CurrentTags"; @Unique(UpdatedList : Tags); @UserName)


For completeness, I also include a toolbar button to wipe out any tags on the document (FIELD txt_CurrentTags := @Unavailable).

So, as you can see, while adding a true tagging mechanism would be ideal, this solution makes it very easy for me to tag documents in my mail file and then use the standard Notes search mechanism to retrieve them more easily. While your mileage may certainly vary, it's a great way to give users the tagging ability without changing any database designs.

Labels: , ,

permalink | leave a comment