KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Form Macro Must Need Class with Function onInvoke to Appear
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: May 17, 2021

When working with form macros, it is important to remember that both the 4D class name (defined in the macro definition) and the "onInvoke" function for the class must exist for the macro to appear in the "Macros" list on the form editor. This is becuase form macros call on the "onInvoke" function of the specified 4D class name in its definition.

For example, given the form macro is defined in formMacros.json and the "my_macro_class" has not been created yet:

{
   "macros": {

         "My Form Macro": {
         "class": "my_macro_class"
          }
     }
}

It will not appear in the "Macros" list. If there are no other form macros to display, there will not be a "Macros" option in the contextual click menu.