Kevin Kempf's Blog

July 7, 2009

Java Color Scheme (POV) change after a clone

Filed under: Oracle, Utilities — Tags: , , , , — kkempf @ 12:50 pm

After a clone, I like to change the Java Color Scheme (Profile Option) of the new environment. This is mostly a visual queue for myself and anyone using the environment. First and foremost, it helps you confirm you’re not in PROD. Since I consistently use the same colors for each environment each time, it also helps confirm you’re in the right flavor of DEV/TRAIN/TEST etc.

After a clone, I got tired of always having to log in to the new environment and update this in the GUI, and thought this script might be helpful to others.  

declare
  cursor c2 is
    select
        fu2.user_id   
       ,fpo.profile_option_name pon
       ,fpot.user_profile_option_name upon
       ,fu2.user_name lov
       ,fpov.profile_option_value pov
    from
        fnd_profile_options_tl fpot
       ,fnd_profile_options fpo
       ,fnd_profile_option_values fpov
       ,fnd_user fu
       ,fnd_user fu2
    where
        fpot.user_profile_option_name = 'Java Color Scheme' 
    and
        fpot.profile_option_name = fpo.profile_option_name
    and
        fpo.profile_option_id = fpov.profile_option_id
    and
        fpo.created_by = fu.user_id
    and
        fpov.level_id = 10001  /* site (10004=user, 10001=site, 10002=Appl, 10003=Resp) */
    and
        fpov.level_value = fu2.user_id
    and
        fpot.language = Userenv('Lang')
    ;
begin
  dbms_output.disable;
  dbms_output.enable(100000)
  ;
  for c2_rec in c2 loop
    status := fnd_profile.save(c2_rec.pon,'&New_Color_Scheme_lower','SITE');
    if status then
      dbms_output.put_line('Java Color Scheme Updated');
    else
      dbms_output.put_line('Java Color Scheme FAILED');
    end if
    ;
    commit
    ;
  end loop
  ;
end
;
/

incidentally, valid values to enter are as follows:

blaf
blue
khaki
olive
purple
red
teal
titanium

As you can see, if you use your imagination, you can modify this script to update virtually any system profile option value.  If you have a user value which needs adjusting, it changes slightly in that a new parameter is required to pass to fnd_profile.save .  This is the user_id (in the c2_rec loop for your convenience).  For example, it might look like this:

status := fnd_profile.save(c1_rec.pon,null,’USER’,c1_rec.user_id);

Well anyways, enjoy, let me know what you think.

Advertisements

Create a free website or blog at WordPress.com.