Wednesday, December 31, 2014

API to Assign Competency to Employee(s)

Salam Alaikum,

   I share with you guys this API, that i used to delete an Appraisal for employees.It assign the competency to employees. But you can use the same API to assign it (competency) to a specific job or position.

DECLARE
l_competence_element_id number;
l_api_ovn number;

cursor app_data
is
--- note1: profeciency level id
--- note2: person id update
--- note3: competence level id should be added to the competences tables and passed here 
    select a.*,c.competence_id,a.rowid
    from XXX_HR_PER_COMPETENCY a , xxxhrdata.xxx_competencies b ,xxx_competency_levels c
    where 1=1
    and a.COMPETENCY_NAME = b.COMPETENCY_NAME
    and b.COMBINATION = c.COMBINATION;       

BEGIN
    for i_rec in app_data
    loop
   hr_competence_element_api.create_competence_element
      (     
       p_business_group_id                 => fnd_profile.VALUE('PER_BUSINESS_GROUP_ID'),
       p_effective_date                    => TO_DATE ('1900/01/01','YYYY/MM/DD'),        
      
       p_competence_id                     => i_rec.competence_id,
       p_proficiency_level_id              => i_rec.PROFICIENCY_LEVEL_id,
       p_rating_level_id                   => i_rec.LEVEL_NO,
       p_person_id                         => i_rec.person_id,
      
       p_competence_element_id             => l_competence_element_id,
       p_object_version_number             => l_api_ovn
      );
           
      update XXX_HR_PER_COMPETENCY u
      set upload_status = 'Y'
      where i_rec.rowid = u.rowid;
       
     end loop; 
END;

Hope you found it useful guys, feel free to leave a comment if have any note on the subject.     

No comments:

Post a Comment