Improving operations

We will now improve the operations that we have defined for our application.

Operations can be invoked not only from the system menu or from the form of a business object or from the screen displaying query results, but also from tables of referred instances displayed inside business object forms. For example, the form of the Member object displays a list of member loans, where each loan represents an entry in this table. We want to be able to have a button next to this entry that will invoke the Renew Loan operation and another button that will invoke the Return Item operation.

To achieve this we select the Loans attribute of the Member object and then click on the Presentation tab on the list of properties. Then we click on the Widget settings property. On the dialog that appears we click on the “Add” button located next to the “Operations with items” table. We specify the name of the operation “Renew”, select the type of the operation “Start Process” and select the process to be started RenewLoan. We click on the OK button on this dialog and define another operation called Return that starts the CloseLoan process.

In a similar fashion we will also add the “Cancel” operation starting the CancelReservation process to the Reservations attribute of the Member object.

If an operation is not applicable under certain circumstances we may not want to show the button invoking the operation at all. For example, if an item is already on loan we do not want to show the “Borrow” button. Of course, even if the button was there and the user clicked on the button, she would still get the error message and no harm will be done (our business rules should take care of invalid situations irrespective of whether the button is shown or not). It would be better, however, if we could hide the button as well.

To achieve this we need to enter the applicability condition for the operation, in other words the conditions under which the operation is applicable. In the case of the item that is to be borrowed the condition should check whether the item is available:

Item.Available = 'Yes' 

We need to enter this condition to the operations invoked from both the form of the Item object and from the screen showing results of the Item query. We open the Item object for editing and select its “Editing” form on the “Forms” tab. Then we click on the “Panel Operations” property in the list of properties of the form and then select the Borrow operation and click on the “Edit” button. We enter the above condition into the Applicable when text box. Now we open the Item query, click on the Display as property, select the Borrow operation in the list of Operations with items and perform similar changes there.

Other conditions that we will enter are:

OperationInvoked fromCondition
ReserveItem object form
Item query
Item.Available = 'No'
ReturnLoan object form
reference table of the Loans attribute of the Member object
Loan.Status = 'Current'
RenewLoan object form
reference table of the Loans attribute of the Member object
Loan.Status = 'Current'
CancelReservation object form
reference table of the Reservations attribute of the Member
Reservation.Status='Waiting' OR Reservation.Status ='Offered'
  • Last modified: 2022/09/13 18:15