Monday 3 December 2012

Advanced Dynamic Action - Apex


In this post I'll cover how to create an Advanced Dynamic Action. 'Advanced' allows you to create more complex native dynamic actions such as 'Add Class' or 'Set Value' and also plug-in dynamic actions, that are installed in your application.

In this example I want to retrieve the department for a given employee.

In the Application Builder you find a new region (tree record) called "Dynamic Actions". Right click on that and click Create


In this post we select Advanced, as we want to create an Advanced Dynamic Action, that does more than just show/hide or enable/disable.


Give the dynamic action a meaningfull name e.g. Refresh Employee List

Tell the dynamic action when it needs to fire. In this case I want that something happens whenever I change from Employee (P25_EMPNO).


Select the action you want to do. In this example I want to set the value of an item (the department) for an employee. The value can be retrieved in a number of ways, but in this case I search the department with a SQL Statement.


Finally you tell the dynamic action what item it needs to update. What you want to update can also be a Region, a DOM object or a JQuery Selector.


Hit the Create button and you are good to go! Not a single line of Javascript to get this done!
You see the example in action here.

If you want to combine different actions in one dynamic action, that is possible too. You can add multiple actions when the condition is true or false. (See True/False Actions)


There are many Actions you can chose from. If you imported or created Dynamic Actions plugins, you find them in there too.


Dynamic Actions are VERY VERY powerful and have an unlimited amount of possibilities. Although the above is classified as an "Advanced Dynamic Action" it's still a fairly simple example. In Part 3 I'll show how to combine plugins with dynamic actions to be even more powerful!

The key reasons why I like Dynamic Actions so much:
  • it's a declarative way of creating more interactive websites
  • it allows people without Javascript experience to create more dynamic websites
  • it allows more experienced people to get the job done faster
  • the dynamic content is more structured and always in the same format
  • the dynamic content can be found at one place, directly in the App Builder (not searching in different javascript files anymore!)
  • the javascript is more maintainable (and possible more performant and more secure)

No comments:

Post a Comment