[<10>] ====== Invoking the "Borrow Item" operation from the Member form ====== In this scenario users need to click some button starting the "Borrow Item" operation while they are working with the form of a member. The system already knows the member who wants to borrow (this is the member being viewed/edited) but it needs to ask the user to identify the item to be borrowed. Once the user identifies the item the system needs to create an instance of the ''Loan'' object. In fact, this is all the system has to do, since after the ''Loan'' has been created, the business rules of the ''Loan'' will take over – they will validate the loan and move it to the ''Current'' state if it is valid. So the system needs to perform two steps – ask the user to identify an item and create an instance of the Loan object. These steps can only be performed by rule actions, so we have to create a //process// (see also the "[[docs:2000_concepts:0200_basics:0300_processes_link_ui_business_logic]]" and "[[docs:2500_config_apps:0900_add_edit_processes|Adding/Editing Processes]]" section). A process usually defines a sequence of actions that are executed one after the other. The actions we need for the "Borrow Item" operation are these: PICK FROM Item CREATE Loan WITH Loan.Item = Item, Loan.Member = Member The first action will run the [[:docs:6000_case_study:0400_configuration:0700_operations:0500_find_item|"Item" query]]. Then it will display the results of the query to the user prompting her to pick one item from those displayed. The second action will create the Loan object and initialize its reference attributes with the item that the user has picked at the previous step and the member instance (which is assumed to be in the context of the process). As we said before everything else will be handled by the business rules of the Loan object that are executed when the loan is created. Let us now define the process in the Configuration Tool. Right click on the "Processes" node in the Elements Tree and select "New" from the pop-up menu. The process editor appears in the working area of the screen. Enter the name of the new process ''BorrowItem'' in the list of process properties. Our process expects that some instance of the Member object is already in the context when the process starts (this is the member being viewed/edited), so we must specify ''Member'' as //process input//. We click on the Input property and select the ''Member'' object from the list of available objects and click on the right arrow button to move the ''Member'' object to the list of objects selected as process input. We can now define the actions of the process. We click on the "Textual rules" tab located at the bottom of the editor and enter the above actions using the familiar rule editor. We can now click on the "Save" button to save changes. The new process will appear in the Elements Tree. Now we need to define the operation that will start the ''BorrowItem'' process from the form of the ''Member'' object. To do this open the ''Member'' object for editing and select the "Main" form in the "Forms" tab of the object editor. The "Main" form is the form that //**AwareIM**// creates automatically when a new object is defined (see also "[[docs:2000_concepts:0400_data_entry_and_editing:0100_forms|Business Object Forms]]"). Click on the "Panel Operations" property in the list of properties of the form. Then select the Add Operation button. In the operation dialog specify the name of the operation "New Loan", select its type (Start Process) and – select the "BorrowItem" process from the list of processes. Then click OK and save the changes in the Member object. At runtime //**AwareIM**// will automatically create a button for the user to click on to invoke the process. //**AwareIM**// will automatically put the instance of the ''Member'' object being viewed/edited into the context and will use it as process input when the operation is invoked.