Macros are script programs run by the user. Macros perform automated operations on a set of records and can automate bulk operations that would be inconvenient for the user to perform on many individual records. Users run macros by selecting them from the Run Macro menu in a data view.
What do you want to do?
Adding a new macro
-
Open the Designer.
-
Expand the Macros section in the Design Object Pane, and click
Create New Macro...
Note If you don't see a Macros section, check the
Show Advanced Design Features box.
-
Enter a name for the macro.
This name will display in the Run Macro drop-down menu in
the toolbar.
-
Select an implementation language from the Language drop-down menu.
-
Select an option to define the scope of the macro (for example, "All records"
or "Selected records".
-
Add the required macro code in the code window.
To help you keep your macro code organized, you can add
code to the More Code window (Click
More Code). This is useful for setting up code for
calling functions and declaring global variables.
You can also add lookup strings: Click
Create Lookup String, select your
lookup targets in the dialog box, and click
Copy. The Lookup string code is placed on the
clipboard. You can then paste it into your macro code.
Note You cannot perform a lookup on records stored
in a Forms tool in another workspace.
-
If you want, select options for restricting access to the
macro.
-
Save your changes.
When the user runs a macro, it is called once for each record in the set. Note that global variables
are initialized before the first record in the set and retain their value from
one record to the next. The order in which the macro is called for each record
in the set is undefined.
In the macro code, access to the Forms tool
record is provided by the i_FormRecord parameter. You can use the record to
read or set the record's fields or to get the parent record. Access to the
Forms tool services is provided through the
i_FormsToolUIDelegate parameter. Additional context information is provided by
the global functions in the Public.js script.
Top of Page
Restricting access to macros
A custom tool designer can restrict access to macros in the following ways:
Making a macro available only to selected members
You can make selected macros available to members depending on their roles. You
can also make selected macros available to selected members regardless of their
role.
-
Open the Designer.
-
Expand the Macros section and select the macro you want to modify.
-
Click the Access tab.
-
Do any of the following:
-
Check the member roles you want to allow to run the macro.
-
In the Member list, check members you want to allow to run the macro regardless
of their role.
-
Save your changes.
Top of Page