Have you ever want to quickly modify "hidden," "internal" or "system" fields of a document but without having to build an agent?
The quickest way is to use a toolbar button!
Imagine you have a document with a system field like "Status". This field is mostly computed and can only be modified through some code behind a button like "Send for Approval" or "Accept the Review." But this code may prevent the change of the Status, even if you have author access to the document.
You want to modify the "Status" field, but you don't have the designer access and the "create private agents" attribute.
The quickest solution is to add a button in the toolbar, and code the @formula to modify the field:
- Go to File-Preferences-Toolbar Preferences
- In the Customize tab, click on New-Button
- Enter the caption text, optionnaly a popup and an icon,
- Add the code to modify the document fields, for example: FIELD Status := "Wiating for Review";
- Save your toolbar button by clicking on OK
- Go to your database and select the document you want to change
- Then click your button in the toolbar!
Remember that a single toolbar button is available for any database!
I picked up a more versatile version of this tip and have implemented it in a number of my Web apps with the button only visible to Notes Clients. It allows me to pick which field I want to change then enter a new value. The main drawback is that it can't set the value in a field that hasn't allready been set in the document. The idea is the same use an action button but use the following formula:
fieldName := @Prompt ([OKCANCELEDITCOMBO]; "Field Name"; "Enter Field Name."; ""; @DocFields); newValue := @Prompt([OKCANCELEDIT]; "New Field Value"; "Please enter new value."; "") ; @SetField(fieldName ;newValue)-- Steve C.
Do you have comments of your own? Let us know.