Using agents to update documents affected by form changes

To update multiple documents affected by form changes, use an agent. To do so, it is best to create private agents and run them manually.

To edit and resave documents

To save the step of editing and resaving documents manually, create an agent that uses the formula:

@Command([ToolsRefreshAllDocs])

To add a field

If you create a new field, create an agent that inserts the new field into existing documents using the formula:

FIELD New field name := value;

where New field name is the name of the field and value is the value you want the field in these documents to have. The value can be the field default value; a formula that calculates the value; or a null value ("") that inserts the field into the documents, but doesn't give them any initial value.

To remove field data from all documents

If you delete a field, existing documents continue to store the obsolete field and its values. This unnecessary storage can affect disk space. To remove the obsolete field, create an agent that uses the formula:

FIELD Field name := @DeleteField;

After you run the agent, compact the database to reduce the actual file size of the database.

To rename a field

If you rename a field, existing documents continue to refer to the old field name. To update documents to refer to the new name, create an agent that uses the formula:

FIELD New field name := Old field name;
FIELD Old field name := @DeleteField;

where New field name is the new name for the field, and Old field name is the original name for the field.

To reassign documents to another form

If users attempt to open documents created with a deleted form, they see a message indicating that the form cannot be found. To prevent users from seeing this message, use these agent options to reassign existing documents to another form.

  1. Click on Agents in the Applications Navigator and then double-click an agent listed in the Work pane. The Agent Properties box appears.
  2. Next to Trigger, check "On schedule."
  3. Next to Target, select "All documents in database" and click Add Search.
  4. In the Programmer's pane, click Formula and enter:

    FIELD Form := "Reassigned form name";

    where Reassigned form name is the name of the form that the documents should use.

To remove the stored form from documents

In designing mail-enabled applications in which users need to see a document and don't have the original form stored in their mail databases, select the form property "Store form in documents." This form property is permanently attached to all documents created with the form. To remove the stored form, remove all internal fields connected with the form by creating an agent that uses the formula:

SELECT $TITLE="Old form name";
FIELD $TITLE:=@DeleteField;
FIELD $INFO:=@DeleteField;
FIELD $WINDOWTITLE:=@DeleteField;
FIELD $BODY:=@DeleteField;
FIELD $ACTIONS:=@DeleteField;

This formula removes all internal fields attached to the documents where Old form name is the name of the form used to create the documents.

To specify a form to display documents

You can display a document with a form that you specify rather than a stored form.To do so, create an agent that uses the following formula:

FIELD FORM:="New Form name";

This line creates a FORM field where New Form name is the form that will display the documents.

To recover additional space

You can delete items with the suffix "_StoredForm" and "_StoredSubFormN" where N is the number of subforms used by the form. (If the form does not use subforms, then "_StoredSubFormN" does not exist.) Determine the number of subforms and then delete each of them by running a LotusScript® or Java agent. You can recover additional space by deleting the following items: $StoredFormCRC, $FormRepID, and $Subform_RepIDS.

After you run the agent, compact the database to reduce the actual file size of the database.