Forum Discussion

keshavkelkar's avatar
8 years ago

FreeMarker template error

what is to be done if I gets this error saying 

The following has evaluated to null or missing:
==> env.context.message 

that i am missing  

env.context.message 

 Please let me know what can be done to fix this ?

    • keshavkelkar's avatar
      keshavkelkar
      Ace

      PerBonomi   Can you please tell me the REST call to or alternative way to get ${env.context.message.id}  ?

       

      I am getting freemarker error when I try to access ${env.context.message.id}, so I need some alternative way such as REST call or any other so that I could get the same value  as I am getting by ${env.context.message.id} .

       

      • jferrandis's avatar
        jferrandis
        Expert

        depndening of what you really whant to do in your component, you can use such kind of snippet :

        <#assign messagesQuery = rest("2.0","/search?q=" + "SELECT * FROM messages WHERE foo='bar' ORDER BY post_time DESC LIMIT 5"?url) />
        <#if messagesQuery.data.size gt 0>
        <#list messagesQuery.data.items as message>
        <#-- do some stuff -->
        ${message.foo} will print 'foo'
        </#list>
        </#if>

        See the message Table structure for more precision about query filters and sort options

        If you want more help you should explain precisely what you want to :
        - what is your component for?
        - where you want to use it? (which page).