!!!How to Define User Procedures

The Define Procedure process allows you to link together two or more system functions to complete a task.  This is known as a Procedure.

The procedure can take you through a sequence of the various screens and/or reports required to complete a task.  A typical procedure would be anything that requires multiple record changes.  Examples would be creating a new job or position, new hire(s), transfers, change of marital status, etc.

When you are finished entering date into a procedure screen, clicking ‘Next’ will commit the changes to the database and will navigate the user to the next sequential step in the procedure. Clicking ‘Finish’ will complete the procedure and will close it out.

__MISC NOTES__\\
If you want a change reason to ‘default’ on a certain form within the procedure, then you must add the change reason to that particular function definition. Currently, there is no way to mark a certain set of change reasons on a form, to be used only when the form is part of a procedure. 
!!Required Set Up

!Step 1 - Maintain Functions [IMFN]

User procedures are first defined on the Maintain Functions ([IMFN]) screen.
*Click on the Add Record icon  
**Select the product that the procedure will be used for (i.e. HR for any Human Resource related procedures like a New Hire procedure)
**Enter a [function name|FUNCTION_NAME] for the procedure (i.e. NEW_HIRE)
**Enter a [description|DESCRIPTION] for the procedure 
**The [Usage|FUNCTION_USAGE] field MUST be set as ‘User Defined’
**The [Function Type|FUNCTION_TYPE] field MUST be set as ‘User Procedure’
**Enter the subject table that is associated with the procedure (i.e. for our New Hire procedure, the subject table is the [P2K_HR_EMPLOYMENTS] as these are the tables created/updated with a new hire)
**All other fields on [IMFN] are optional
**The Purpose field can be used to indicate the purpose of the procedure.  (i.e. to streamline the new hire process ensuring all appropriate screens/forms have been updated.)
*Execution Rights tab  - [P2K_MASTER] role should be defined here for all new functions, in addition to any other roles that are required for users to access this procedure


!Step 2 - Define User Procedures [IMPC]
The second step in creating the procedure is going to the Define User Procedures ([IMPC]) screen. The information entered for the function created in step 1 will be seen in the header portion of the screen. 
*Procedure Steps tab
**[Seq# |STEP_SEQUENCE]- The sequence number in this field dictates the sequence in which the procedure steps are performed.
**Function Name – This field holds the abbreviated screen name of the function to be executed as part of the procedure.
**[Description |DESCRIPTION]– This field displays the full screen name of the function to be executed as part of the procedure.  This name will default in when the function is chosen.
**[Mandatory|MANDATORY] – If this toggle is checked ‘on’, the form must be completed before the user may either go to the next or previous function, or exit the procedure.
**[Display Find|DISPLAY_FIND] - This toggle enables the function's find block to display within the procedure. The user would be allowed to select an employee from the list. This is typically used on the first step in the procedure.
*Procedure Step Overflow
**[Create|CREATE_ALLOWED], [Retrieve|RETRIEVE_ALLOWED], [Update|UPDATE_ALLOWED], [Delete|DELETE_ALLOWED] – These toggles are used to determine what execution rights the user has when running the procedure.  The CRUD defined will only restrict what is already set up for the report on [IMFN].
**Command – This field may contain a SQL statement that is to be executed by a procedure step.

!!Executing the Procedure
1. In the Command line, enter in the procedure name.  (i.e. NEW_HIRE)\\
2. The first screen will automatically be brought up\\
*The Header information indicates the procedure and identifies the step by function. 
*Navigation
**Back – allows the user to go to the previous step in the procedure
**Next – allows the user to go to the next step in the procedure
**Cancel – Reverts all changes entered
**Finish – Commits all changes entered


!!Different Types of Procedures

There are different types of procedures, depending on what the intent of the procedure is. There may be procedures that are used to add data such as a New Hire procedure where a user would be adding a new employee to the system. Another type of procedure would be to change existing data such as HR changes or terminations. Another type would be processing type procedures where specific update functions or report functions are accessed in a procedure, an example of this would be a payroll procedure. 

When changing existing data a header should be added to the procedure.

[{If var='loginstatus' contains 'authenticated'

----
![Discussion|Edit:Internal.HOW TO DEFINE USER PROCEDURES]
[{InsertPage page='Internal.HOW TO DEFINE USER PROCEDURES' default='Click to create a new discussion page'}]

}]