Friday 17 November 2017

How To Setup Calendar Events By Locations (Doc ID 1917689.1)

PURPOSE

 In Fusion HCM, Public Holidays are defined as Calendar Events which are linked to a country or locations via a Geography Tree. A global Work Schedule is then defined with the Public Holidays specified as Exceptions.

This document illustrates how to set up a Geography Tree, and a Calendar Event for use in HCM Work Schedules.

SCOPE

 The document is part of a series of high level articles with the intention of explaining how to set up work schedules with a view to monitoring worker availability in Fusion HCM.

DETAILS

1. Define Geographic Regions
 To create Geographic Regions use lookup type “ORA_PER_GEOGRAPHIC_TREE_NODES”
      Navigate to Manage Common Lookups
     
      Search for lookup type “ORA_PER_GEOGRAPHIC_TREE_NODES”
 
    Add all the Geographic regions that you require in the look up codes.
    It should be noted that the values entered in the lookup code should NOT be the same as the country abbreviations, such as DE, US, IN etc.
2. Define Geography Tree
     Navigate to Manage Geography Trees
   
    Click Create
   
     Enter Details and Click next
   
     Click Next
   
     Click Submit
   
     Select “NE Fast Bank India” in the search results and click on create Tree Version
   

     Enter the details and click Next
   
    Click ok
   




     Click on Add button
     
   
    Change the Data Source to “Geographic Tree Calendar Event Data Source”
    And this will show all the locations created under lookup “ORA_PER_GEOGRAPHIC_TREE_NODES”
    Select Global and add to the nodes
   
    Click ok
    Select Global and Click on Add
   
     Select the locations and move them under selected nodes
   


    Click ok
    Click Submit
     
    The following message will be displayed:
    Tree version NE Fast Bank India Version 1 for tree NE01 created successfully
    and the Specify Nodes page should now look like this.
   





     Row Flatten Tree Version
    From Search Results screen, select the Tree Version row and do Actions -> Flatten -> Row Flattening. This is a technique to make the retrieval of the tree faster.
    
    
    Click on Online Flattening
   




    Click Ok
    Click Done.
     Do Online Audit
     From Search Results screen, select the Tree Version row, and do Actions ->Audit.
    Click on Online Audit button from Tree Audit Result page.

    
   
   Click on Online Audit
 




   A successful audit looks like this
   
   Click Done
    Activate Tree Version
   Finally from Search Results screen, select the Tree Version row and do Actions -> Set Status -> Active
    
   Click Active




 
   The following message will be displayed:

   'Status of tree version NE FAST Bank India Version 1 changed to ACTIVE'
3. Create Calendar Event
    Public Holidays now need to be created for each of the countries, and attached to the respective node in the Geography Tree.

   Using Manage Calendar Events task, click on Create Icon, and enter Name, Category, Date, and Short Name of the Public Holiday. Then under Coverage, choose the Hierarchy Type   of Geographic, and the Hierarchy previously created.
   Expand the Global Node, click on the Locations to whom the Public Holiday is associated, and click on the Include Icon.

 
   Select Hierarchy Type as Geographic and Hierarchy as NE Fast Bank India.
   Select the regions for which the public holiday is applicable
    
4. Add Calendar Event to the Work Schedule
   Once Public Holidays have been entered as Calendar Events for all the regions, an exception can be added to the global Work Schedule so that they are regarded as Off Period, and  workers in that region will be Unavailable for work on that day.
     



   Click Submit.
5. Assign Geographic Hierarchy to the location
    Navigate to Manage Locations à select your location and change the Geographic Hierarchy
   

Tuesday 14 November 2017

WF_ROLES and WF_LOCAL_ROLES difference

wf_local_roles is a table holding the role name and the associated attributes (like mail_preference, mailID etc). This is populated by the wf_directory APIs or by running the conc pgm "Synchronize WF Local Tables". wf_roles is a view based of wf_local_roles. So, the data you can see in wf_roles will be coming from wf_local_roles.

To send email notifications,

1. Ensure that the Notification mailer is up and running
2. Ensure tht the receipient user's mail preference is set as MAILHTML
3. The recipient should be a role in the wf_local_roles table.

reference:
http://smforum.workflowfaq.com/index.php?topic=671.0

Monday 13 November 2017

Restricting Absence Type List of Values in Oracle Self-Service Human Resources

Use the following the sample steps to derive a restricted list of values for absence type LOV in Absence Management. The custom logic has to be written in the New Package function
HR_ABSENCE_RESTRICTED.ABSENCES_RESTRICTED. 

Login person id and selected person id will be passed by default – using these two parameters the rest of the data or parameters can be queried from the tables

The above procedure will be called from the AbsenceTypeVOImpl java file with the proper input parameters and the return value will be appended to the AbsenceTypeVO

We return the absence type ids of the absence we dont want the user to see.


Sample function:

FUNCTION absences_restricted (selected_person_id   IN VARCHAR2,
                                 login_person_id      IN VARCHAR2)
      RETURN VARCHAR2
   IS
      l_abs_type_id   VARCHAR2 (100);
     l_abs_type_value  NUMBER;
   BEGIN
      SELECT   COALESCE (
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Male'
                            AND NVL (
                                  hr_general.decode_lookup (
                                     'MAR_STATUS',
                                     papf.marital_status
                                  ),
                                  'Single'
                               ) IN
                                     ('Single', 'Widowed')
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) IS NULL
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Maternity Leave',
                                           'Paternity Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Female'
                            AND NVL (
                                  hr_general.decode_lookup (
                                     'MAR_STATUS',
                                     papf.marital_status
                                  ),
                                  'Single'
                               ) IN
                                     ('Single', 'Widowed')
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) IS NULL
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Maternity Leave',
                                           'Paternity Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Male'
                            AND hr_general.decode_lookup (
                                  'MAR_STATUS',
                                  papf.marital_status
                               ) = 'Married'
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) IS NULL
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Maternity Leave',
                                           'Marriage Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Female'
                            AND hr_general.decode_lookup (
                                  'MAR_STATUS',
                                  papf.marital_status
                               ) = 'Married'
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) IS NULL
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Marriage Leave',
                                           'Paternity Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Male'
                            AND NVL (
                                  hr_general.decode_lookup (
                                     'MAR_STATUS',
                                     papf.marital_status
                                  ),
                                  'Single'
                               ) IN
                                     ('Single', 'Widowed')
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) = 'Muslim'
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Maternity Leave',
                                           'Paternity Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Female'
                            AND NVL (
                                  hr_general.decode_lookup (
                                     'MAR_STATUS',
                                     papf.marital_status
                                  ),
                                  'Single'
                               ) IN
                                     ('Single', 'Widowed')
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) = 'Muslim'
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Maternity Leave',
                                           'Paternity Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Male'
                            AND hr_general.decode_lookup (
                                  'MAR_STATUS',
                                  papf.marital_status
                               ) = 'Married'
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) = 'Muslim'
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Maternity Leave',
                                           'Marriage Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Female'
                            AND hr_general.decode_lookup (
                                  'MAR_STATUS',
                                  papf.marital_status
                               ) = 'Married'
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) = 'Muslim'
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Marriage Leave',
                                           'Paternity Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Male'
                            AND hr_general.decode_lookup (
                                  'MAR_STATUS',
                                  papf.marital_status
                               ) = 'Married'
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) != 'Muslim'
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Maternity Leave',
                                           'Marriage Leave',
                                           --'paternity leave',
                                           'Hajj Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Female'
                            AND NVL (
                                  hr_general.decode_lookup (
                                     'MAR_STATUS',
                                     papf.marital_status
                                  ),
                                  'Single'
                               ) IN
                                     ('Single', 'Widowed')
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) != 'Muslim'
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Maternity Leave',
                                           'Paternity Leave',
                                           'Hajj Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Female'
                            AND hr_general.decode_lookup (
                                  'MAR_STATUS',
                                  papf.marital_status
                               ) = 'Married'
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) != 'Muslim'
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Marriage Leave',
                                           'Paternity Leave',
                                           'Hajj Leave','Unpaid Leave'))
                    END),
            TO_CHAR(CASE
                       WHEN hr_general.decode_lookup ('SEX', papf.sex) =
                               'Male'
                            AND NVL (
                                  hr_general.decode_lookup (
                                     'MAR_STATUS',
                                     papf.marital_status
                                  ),
                                  'Single'
                               ) IN
                                     ('Single', 'Widowed')
                            AND hr_general.decode_lookup (
                                  'AE_RELIGION',
                                  papf.per_information10
                               ) != 'Muslim'
                       THEN
                          (SELECT   listagg (
                                       absence_attendance_type_id,
                                       ','
                                    )
                                       WITHIN GROUP (ORDER BY
                                                        absence_attendance_type_id)
                             FROM   per_absence_attendance_types
                            WHERE   name IN
                                          ('Maternity Leave',
                                           'Paternity Leave',
                                           'Hajj Leave','Unpaid Leave'))
                    END)
         )
            abs_type_id
  into   l_abs_type_id
  FROM   per_all_people_f papf
 WHERE   1 = 1 AND current_employee_flag = 'Y' 
 AND person_id =selected_person_id
         AND TRUNC (SYSDATE) BETWEEN effective_start_date
                                 AND  effective_end_date;
select  XX_Mgr_Shw_Unpd_leave (login_person_id ) into l_abs_type_value from dual;                 
                  l_abs_type_id := l_abs_type_id ||','|| l_abs_type_value  ;
    dbms_output.put_line (' l_abs_type_id2 ' || l_abs_type_id);                  

      RETURN l_abs_type_id;
   EXCEPTION
      WHEN OTHERS
      THEN
         RETURN -1;

   END absences_restricted;

VO query would be updated as per the below sample.


SELECT * FROM (SELECT paat.ABSENCE_ATTENDANCE_TYPE_ID , paat.BUSINESS_GROUP_ID , paat.INPUT_VALUE_ID , paat.DATE_EFFECTIVE , paattl.NAME , paat.ABSENCE_CATEGORY , paat.DATE_END , paat.HOURS_OR_DAYS , paat.INCREASING_OR_DECREASING_FLAG , paat.REQUEST_ID , paat.PROGRAM_APPLICATION_ID , paat.PROGRAM_ID , paat.PROGRAM_UPDATE_DATE , paat.ATTRIBUTE_CATEGORY , paat.ATTRIBUTE1 , paat.ATTRIBUTE2 , paat.ATTRIBUTE3 , paat.ATTRIBUTE4 , paat.ATTRIBUTE5 , paat.ATTRIBUTE6 , paat.ATTRIBUTE7 , paat.ATTRIBUTE8 , paat.ATTRIBUTE9 , paat.ATTRIBUTE10 , paat.ATTRIBUTE11 , paat.ATTRIBUTE12 , paat.ATTRIBUTE13 , paat.ATTRIBUTE14 , paat.ATTRIBUTE15 , paat.ATTRIBUTE16 , paat.ATTRIBUTE17 , paat.ATTRIBUTE18 , paat.ATTRIBUTE19 , paat.ATTRIBUTE20 , paat.LAST_UPDATE_DATE , paat.LAST_UPDATED_BY , paat.LAST_UPDATE_LOGIN , paat.CREATED_BY , paat.CREATION_DATE , paat.COMMENTS from per_absence_attendance_types paat, per_abs_attendance_types_tl paattl where paat.BUSINESS_GROUP_ID= :1 and (paat.date_end is null OR paat.date_end > sysdate) and (paat.date_effective < sysdate) and paat.absence_attendance_type_id = paattl.absence_attendance_type_id and paattl.language = userenv('LANG') and ((hr_api.return_legislation_code(paat.business_group_id) = 'GB' and paat.absence_category not in ('M','GB_PAT_ADO','GB_PAT_BIRTH','GB_ADO','GB_ADDL_PAT_ADOPT','GB_ADDL_PAT_BIRTH','GB_SPL_BIRTH','GB_SPL_ADOPT')) or (hr_api.return_legislation_code(paat.business_group_id) <> 'GB' and paat.absence_category not in ('GB_PAT_ADO','GB_PAT_BIRTH','GB_ADO','GB_ADDL_PAT_ADOPT','GB_ADDL_PAT_BIRTH' ,'GB_SPL_BIRTH','GB_SPL_ADOPT')))) QRSLT WHERE (ABSENCE_ATTENDANCE_TYPE_ID not in(63,65,67,1063,67)) ORDER BY Name