Action Script Naming

From Pengower
Jump to: navigation, search

Action Naming protocols enables you to easily identify actions and their functions. Naming protocols help you to identify which related processes are involved as well.

If an Action Script is being called directly from a menu, the name needs to be 'user friendly' and direct. It should directly tell you the action's purpose eg. List Members.

If an Acion Script is not being called directly from a menu, then the name needs to have the following format:

{Prefix} {Type/Form/Group Name} {Descriptive Name}


Where {Prefix} is either:

  • tm representing a type method
  • ta representing a type action
  • fa representing a form action
  • ga representing a group action
  • fn representing a function


So how do you know which prefix to use?


Imagine you have a Supplier type and on this type is an ACTION_BUTTON element named Add a Supplier Contact for this Supplier. Clicking on this button will call an Action Script. A good name to give to this Action Script would be ta Supplier Add Supplier Contact. This is because the Action Script is associated with a specific type and with an action (ie. clicking of a button) therefore the prefix will be ta. Within a ta you expect to see reference to Current_Item.


The saving of the Supplier type is performed in many areas of the application therefore it is saved with a name of tm Supplier Supplier Save. Because it is associated with a specifc type and contains code that is not necessarily associated with a specific action (a saving of Supplier may also be required in another Action Script that performs batch processing) it is given a tm prefix. Within a tm you expect to see reference to a passed entity but not to Current_Item.


Where possible put any code relating to a specific type into a tm and then call it from a ta (eg. ACTION_BUTTON on a type), fa (eg. ACTION_BUTTON on a form) or ga (eg. action on a group). Returning to the ta Supplier Add Supplier Contact example (above) we would now expect this to contain code calling tm Supplier Add Supplier Contact.


The prefix fn is reserved for general processing, not associated with a specifc form, type or group. Eg fn Send SMS, fn Calculate Workday, fn Replace Tokens etc.


IMPORTANT:

If you are placing code in a tm and then calling it from a ta, fa or ga; what happens if an error occurs in the tm? It is very likely that you will need to pass back the error message and an object.

You should do this by passing the error back as Report and the object as Output.


See Also

How to Create Action Scripts

Script Action Library