Search code examples
lotus-noteslotusscript

Toggle a custom icon on an Action Button on Lotus Notes form


When editing the action button properties, it allows an @if statement to flip/flop two choices (lock/unlock). i.e. @If(enlock=1;"Unlock";"Lock") for the "Label" of the action button. At the bottom of the Action properties, icons can be None, Notes, or Custom. When I select Custom, I want the @if to use either the Locked/Unlocked Notes icons. (actn084.gif and actn085.gif, respectively) Or numbers #62 (locked) and #(I don't know/can't find, the # for the unlock icon). I've tried formula with the icon number, like in a view, "display as icons" for view column. Using an @if, I've tried the gif on local and server replica's and it didn't give any results. Please see the example image below.

Image example: https://i.sstatic.net/UBac3.png


Solution

  • You have to add actn084.gif and actn085.gif to Resources/Images.

    enter image description here

    Then, you can use a formula

    @If(enlock=1;"actn085.gif";"actn084.gif")
    

    for calculating icon.

    As an alternative, you could create two buttons and hide-when them depending on field enlock. You could assign label and icon direct to buttons without formula then.

    The hide formula would be enlock=1 for first button and enlock!=1 for the second. In both buttons you would have to add @Command([RefreshHideFormulas]); at the end of your action formula to refresh the action buttons (or Call uiDoc.RefreshHideFormulas for LotusScript action code).