Another Way to Change the definition of the default Theme42 template

As default, the templates of newly created desktop application which subscribes default Theme42 will be locked.  If we open a certain template from shared components \ templates, we will find the description below from subscription section.
This template is subscribed to the corresponding template in the master theme. To modify this template, edit the master template and then refresh the theme. Alternatively you can create a local, unsubscribed copy of this template. Unsubscribed templates are editable and will not get overwritten by a theme refresh.
So there are two recommended ways to modify a template definition.

However, there is another scenario. I want to change the definition of the Standard region template frequently but I don't want to copy out, rename and reassign previous regions to the new template.

Here is a quick solution for this case. Just execute sql below to unlock the subscription.
-- give correct application id in line 3
update apex_050100.wwv_flow_page_plug_templates s
   set s.reference_id = null
 where s.flow_id = 200; 
After commit and refresh the template definition page, we will find "delete" and "Apply Changes" buttons displaying and the definition of template are editable.
Note: this method is for developing, debugging and testing. Please do not use this on production. Because it's risky to modify app's metadata.
After developing, debugging and testing, we might need to re-subscribe the template to theme42 or might not. If need, we can execute update statement below and commit to restore the data.
-- adjust proper interval for flashback in line 4
update apex_050100.wwv_flow_page_plug_templates r
   set (reference_id, template) =
       (select reference_id, template
          from apex_050100.wwv_flow_page_plug_templates as of timestamp(systimestamp - interval '50' minute) t1
         where t1.flow_id = r.flow_id
           and r.id = t1.id)
 where r.flow_id = 200
We also can do the same operation to other tables for other components, like page, report if need.

Comments

Popular posts from this blog

Note for APEX 5.1 UI, Theme, Templates and Substitution Strings

RDS Customizable for APEX 5.1

Use Plugin Code Editor - Part 1/4: Demo