A Legacy Notes Developer's journey into madness.

Tim’s Magic Button

Devin Olson  March 31 2015 03:05:12 PM
Whenever I set up a new Notes Client, there are a certain set of "things" I do to tweak it a bit and make it easier for me to work.

I'm sure everybody has their own set of these "things" as well.  

Today was no different.  I had just finished a clean install of a new development VM, and was working in my freshly installed Notes Client when I remembered (because I needed it) that I had forgotten to install a bit of code I call Tim's Magic Button.  

Several years ago my partner Tim Tripcony and I were working at a client's site, and he showed me this custom Smart Icon Toolbar button code.   It is concise, clean, and absolutely brilliant (much like Tim -RIP my friend).  

You may ask "What does it do?"  (Go ahead, ask out loud)  

Well, it allows you to select a document from a view and then add, edit, or delete any field on the document. Nothing more, nothing less.   But sometimes, that is exactly what you need.

Anyway, here is the code:

targetField := @Prompt([OkCancelEditCombo]; "Select Field"; "Select a field to override:"; ""; @DocFields );
updateTypes := "Text":"Number":"Time":"Delete Field";
updateType := @Prompt([OkCancelList]; "Select Type"; "Choose a type or action:"; "Text"; updateTypes );
@If(updateType = "Delete Field"; @Return(@SetField(targetField;@DeleteField)); "" );
newValue := @Prompt([OkCancelEdit];"New Value";"Enter the new value:"; @Text(@GetField(targetField )));
newTypeValue := @Select(@TextToNumber(@Replace(updateType; @Subset(updateTypes;3);"1":"2":"3" )); newValue; @TextToNumber(newValue); @TextToTime(newValue));
@SetField(targetField; newTypeValue)


Some time after giving me this code Tim wrote a blog post about it (my how time flies) .  You can read his post here.