Skip to main content

How to Synchronize Email Address between User and HR Employee


Whenever you change the email address of a HR Employee record you will notice that this change in the email address is not reflected within the user account. For example for the below employee I changed the email address through a correction update in HR.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqKVDHP43zd7fpPy1DA8INVryBYIrkpvz9krLHUkwfJCBTmy1Cahn2yi5qkTwlLuJHjRb4HrZcFGpVXQS8tTVn43-vrNgy-i9bkPHrdysD9K3BaMBLa5jtJyuwmsTFEYiCc0moa7MWdGes/s400/SyncEmail.gif

On the account of this user to which the HR Employee record is assigned this change is not reflected.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSwIx8UrhYB2ruDrYrdKzoHd4LYwM8-MYBTU1oezbu6P-nJRcUL5-_8x4QOeaKNzGzX4u4WHvHY6baBpNwPPL0gnu74QUNOTocxbK6LCc9c_N6NtXbF6og3BFFAVFsC60h2FRakF_r-TJB/s400/SyncEmail2.gif

In other words the email address assigned to the user and to the related employee do not match. This will generate problems with workflow notifications if they are being sent through the Workflow Notification Mailer.

Currently there is no direct update functionality from HR to the FND_USER table. Oracle will only execute an update to the WF_LOCAL_ROLES table from the APPLSYS schema (for future assignments of the employee to a user). Also after running concurrent program Workflow Directory Services User/Role Validation only the WF_LOCAL_ROLES table is updated and not FND_USER.

SELECT
    *
FROM
    APPLSYS.WF_LOCAL_ROLES
WHERE
    ORIG_SYSTEM = 'PER'
    AND PARENT_ORIG_SYSTEM_ID = <person_id_hr>

Enhancement requests are logged to have this feature as it is crucial for correct Workflow behaviour.

Only remedy for now is to schedule a SQL update to keep the email addresses between HR and the user in sync. Find below the procedure needed to keep things in sync and to avoid Workflow notification problems. Incorporate this in your custom package.

PROCEDURE p_update_email (p_success OUT BOOLEAN)
 IS
      CURSOR c_user_email IS
      SELECT fu.email_address user_email
            ,pap.email_address emp_email
            ,pap.person_id     emp_person_id
      FROM  fnd_user fu
           ,per_all_people_f pap
      WHERE fu.employee_id = pap.person_id
      AND   fu.email_address <> pap.email_address;
      r_user_email  c_user_email%ROWTYPE;
   BEGIN
      p_success := FALSE;
      IF c_user_email%ISOPEN
      THEN
         CLOSE c_user_email;
      END IF;
      OPEN c_user_email;
      FETCH c_user_email INTO r_user_email;
      IF r_user_email.user_email <> r_user_email.emp_email THEN
        UPDATE fnd_user SET email_address = r_user_email.emp_email
        WHERE  employee_id = r_user_email.emp_person_id;
        COMMIT;
        p_success := TRUE;
      ELSE
        p_success := FALSE;
      END IF;
      CLOSE c_user_email;
    
    EXCEPTION
      WHEN OTHERS
      THEN
         p_success := FALSE;
END p_update_email;

Also a direct update can be done on table FND_USER for user records where email addresses are not synced. Fire below update against your instance for an immediate synchronization between APPLSYS.FND_USER and HR.PER_ALL_PEOPLE_F.

UPDATE APPLSYS.FND_USER FUSER
SET FUSER.EMAIL_ADDRESS = (
                            SELECT
                                PAP.EMAIL_ADDRESS
                            FROM
                                HR.PER_ALL_PEOPLE_F PAP
                            WHERE
                                FUSER.EMPLOYEE_ID = PAP.PERSON_ID
                           )
WHERE EXISTS
    (
        SELECT
            PAP.EMAIL_ADDRESS
        FROM
           HR.PER_ALL_PEOPLE_F PAP
        WHERE
            FUSER.EMPLOYEE_ID = PAP.PERSON_ID
            AND FUSER.EMAIL_ADDRESS <> PAP.EMAIL_ADDRESS
    );
Whenever you change the email address of a HR Employee record you will notice that this change in the email address is not reflected within the user account. For example for the below employee I changed the email address through a correction update in HR.

Comments

Popular posts from this blog

How To Enable / Disable Forms Personalization Option

Forms Personalization gives great flexibility to execute custom business logic without performing so much of technical work. To start forms personalization navigate to Help -> Diagnostics -> Custom Code -> Personalize But many time when we click on personalize it give below error  " Function is not available for this respnosibility. Change responsibilities or contact your System Administrator " To Enable access to forms personalization function we need to set below profile option.  -  Utilities:Diagnostics -> Yes / No It determines the diagnostics option is enabled for a user / responsibility or site, depending on the level profile option is set. Navigate to System Administrator -> Profile -> System Query for your user / responsibility for which you want to provide access. Set the value to 'Yes' , If you want allow access to forms personalization Since we change the profile option please change the respons...

Query to find Operating Unit, Business Group and Legal Entity Information

SELECT   DISTINCT   hrl . country ,                  hroutl_bg . name              bg ,                  hroutl_bg . organization_id ,                  lep . legal_entity_id ,                  lep . name                    legal_entity ,                  hroutl_ou . name              ou_name ,               ...

Oracle Purchasing – Receipt Accounting

Oracle Purchasing – Receipt Accounting (Accrue On Receipt and Accrue at Period End) Inventory Accruals: Inventory and Purchasing provides visibility and control of accrued liabilities for inventory items. Purchasing automatically records the accrued liability for the inventory items at the time of receipt. This transaction is automatically recorded in the general ledger at the time of receipt. The inventory expense is recorded at delivery if Standard Delivery is used and at receipt if Direct Delivery used. Expense Accruals: Purchasing optionally accrues un-invoiced receipts of non-inventory items when a period is closed. Purchasing automatically creates a balanced journal entry for each receipt un-invoiced at period end which can be reversed at the beginning of the next period. Navigation: India Local Purchasing > Oracle Purchasing > Setup > Organizations > Purchasing Options Difference between 'Accrue On Receipt' and 'Accrue at Per...