Added support for trigger on next for templates.