Linking extensions to a business object
Preconditions:
• You have configured the intended business object so that any required actions, statuses and status transitions are available and compatible with the new business rule. For example: if a specific warning should appear before a certain status transition is applied, it is necessary that this status transition is available for the intended business object in Field definer and is made visible through Layouts .
| For more information on creating user-defined business objects, together with statuses and actions, see User-defined business objects. For more information on making actions and statuses available in a TSI, refer to the Layouts part of the documentation. |
In the following procedure, a specific case serves to illustrate how you can link extensions to a business object.
Case:
By default, Planon ProCenter does not check whether a budget has been specified for a work order when an end user sets his work order from Reported to Accepted. The work order can be saved even though no budget has been selected in the Budget field. Suppose an organization would like to see that the selection of a budget is enforced by Planon ProCenter . They have programmed an extension that produces an error message if a user tries to change the status of the work order to Accepted while no budget has been selected.
The programmed extension has been made available on the application server and has been registered. Subsequently, it can be linked to a business object in Field definer :
Procedure
1. Go to Field definer > Business objects.
2. Select the relevant business object, in this example the Orders business object.
3. Set the business object’s status to Under construction.
4. Select the relevant business object and go to Details > Extensions.
If you select the base level (in this example: Orders), the extension will apply to all lower levels. If you select a system level (in this example Work orders), the extension will apply to that system level and the underlying user-defined levels. If you select a user-defined level, the extension will only apply to that level only. In our case, the Planon administrator chooses to apply the extension to work orders (system level).
5. On the General tab, complete the mandatory data fields.
◦ Extension: select the relevant extension from the selection list, which includes extensions that have been registered in > .
◦ Parameter: enter the possible parameters to the extended action. The parameters can be passed as a key value pair, an XML string, Java code or as an SQL query and should be parsed accordingly in the extended action class.
◦ Event type: select the event after which the extension should take effect. An event may be any action by a user: selecting, changing, adding, deleting etc.
| It is recommended to exclude messages (errors, warnings or confirmations) from extensions that you intend to link to the AfterRead (AR) event type. This way, you prevent messages from popping up in a needless frequency after user actions that involve reading data from the database. The AfterRead event type is especially intended for extensions on calculated fields, which are updated automatically after a user action. |
◦ Activated: select Yes.
◦ Sequence of execution: enter a sequence number referring to the sequence in which the extension should take effect. In this example, only one extension is available, so 1 is entered.
| The sequence is especially relevant if multiple extensions have been linked to an individual level of a hierarchical business object, such as Orders. By specifying a sequence number for each extension available at a certain level, you can determine the sequence in which the various extensions should take effect. |
6. Click Save and change the business object's status to Completed.
Your extension is now ready to be tested.