0

I've implemented an application using Moqui Framework.I am trying to load database table in a drop down in Header.html.ftl file.how to use service-call in Html.ftl.Is there any other way to load Data?

Rolla
  • 61
  • 1
  • 7

1 Answers1

0

Data preparation such as this can be done using the Moqui API in an #assign directive in an FTL file, though generally it is easier and better to do it in the screen.actions element for the screen that includes the FTL file.

There are examples of using the Moqui API (through an ec.entity.find() call) in an FTL snippet in the SimpleScreensSetupData.xml file (in the moqui/SimpleScreens repository). That file contains data that is loaded into the database to add a header navbar item with a small FTL template that is rendered to show outstanding messages, events, etc.

Here is one line from that file:

    <#assign taskCount = ec.entity.find("mantle.work.effort.WorkEffortAndParty").condition("partyId", ec.user.userAccount.partyId!).condition("statusId", "not-in", "WeClosed,WeCancelled").condition("workEffortTypeEnumId", "WetTask").disableAuthz().count()>

What you would need is a variation on this that gets a list back to iterate over using the FTL #list directive.

David E. Jones
  • 1,721
  • 1
  • 9
  • 8