Wednesday, May 14, 2014

API to Update User Preferences

DECLARE
   l_user_name       VARCHAR2 (500) := 'BIJOYJ';
   l_module_name     VARCHAR2 (50) := 'WF';
   l_err_msg         VARCHAR2 (1000) := NULL;
   l_pref_tab_type   FND_PREFERENCE.prefs_tab_type;
                       
   l_counter         NUMBER := 1;
BEGIN

   l_pref_tab_type(l_counter).name := 'MAILTYPE';
   l_pref_tab_type(l_counter).value := 'MAILHTML';  --> HTML Mail with Attachments
   l_pref_tab_type(l_counter).action := 'I'; -- I -> Insert U -> Update


   FND_PREFERENCE.
    SAVE_CHANGES (p_user_name     => l_user_name,
                  p_module_name   => 'WF',
                  p_prefs_tab     => l_pref_tab_type);

   COMMIT;
   DBMS_OUTPUT.put_line ('User Preference Loaded !!!  ' || l_user_name);
EXCEPTION
   WHEN OTHERS
   THEN
      l_err_msg := SUBSTR (SQLERRM, 0, 1000);
      DBMS_OUTPUT.put_line ('Main Exception:  ' || l_err_msg);

END;

No comments:

Post a Comment