Wednesday, 23 October 2013

How to update user mail ID by using API

-------Step 1: Run below query by giving input parameters


DECLARE
   v_user_name       VARCHAR2 (100) := :user_name;    --->enter user name here
   v_email_address   VARCHAR2 (100) := :update_mail_id; ---> enter new mail id here
BEGIN
   fnd_user_pkg.updateuser (x_user_name                    => v_user_name,
                            x_owner                        => NULL,
                            x_unencrypted_password         => NULL,
                            x_session_number               => 0,
                            x_start_date                   => NULL,
                            x_end_date                     => NULL,
                            x_last_logon_date              => NULL,
                            x_description                  => NULL,
                            x_password_date                => NULL,
                            x_password_accesses_left       => NULL,
                            x_password_lifespan_accesses   => NULL,
                            x_password_lifespan_days       => NULL,
                            x_employee_id                  => NULL,
                            x_email_address                => v_email_address,
                            x_fax                          => NULL,
                            x_customer_id                  => NULL,
                            x_supplier_id                  => NULL,
                            x_user_guid                    => NULL,
                            x_change_source                => NULL);
   --COMMIT;
   DBMS_OUTPUT.put_line (
      'User ' || v_user_name || ' is Updated successfully');
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line (
         'Error encountered while updating the user and the error is '
         || SQLERRM);
END;


--------Step 2:  Now run  below query to cross verify mail id

SELECT user_id, user_name, creation_date, start_date, end_date, description,
       email_address
  FROM fnd_user

 WHERE user_name = UPPER (:user_name)