@UpdateFormulaContext (Formula Language)
Updates the context of a formula to the Notes® client window currently being accessed by the code. For example, if the code accesses a new form called "Response" by using @Command([Compose]:"Response", @UpdateFormulaContext switches the context of the formula to this new form. Any subsequent functions in the code execute in the context of the Response document, not the current document.
Syntax
@UpdateFormulaContext
Usage
You can use @UpdateFormulaContext to extract values from or set values in external documents. You can even access document- and database-specific information using functions such as @DbName, @DbTitle, @Created, @DocumentUniqueID, @GetDocField, @GetField, @GetProfileDocument.
This function is only valid in the Notes® client; it is not supported in Web applications. @UpdateFormulaContext is only valid in formulas that interact with the user, such as in agents that have no target documents, events, toolbar buttons, hotspot buttons, and actions. It does not work in formulas in which @commands cannot be used.
Examples
- The following code, when used in a view action, creates a response
document to the currently selected document then populates its fname
and lname fields with the values of the fname and lname fields in
the current document:
tempfname := fname; templname := lname; @Command([Compose];"Response"); @UpdateFormulaContext; FIELD fname := tempfname; FIELD lname := templname
- The following code, when used in a view action that contains documents
that have the fields "CreatedDate," which displays the document's
creation date and "nextCreated," an editable text field, opens the
previous document in the view and adds the creation date of the current
document into its "nextCreated" field:
tempDate := @GetDocField(@DocumentUniqueID;"CreatedDate"); @Command([NavPrev]); @Command([EditDocument]); @UpdateFormulaContext; @SetDocField(@DocumentUniqueID;"nextCreated";tempDate)