Forum Discussion

PAULEM's avatar
PAULEM
Advisor
6 years ago

env.context.message.uniqueId returns null

Hi I have a script on my ForumTopicPage that captures the id of the original post.  I have used this: <#assign msg_id = env.context.message.uniqueId /> <#assign msgQuery = "SELECT * FROM messages ...
  • Parshant's avatar
    Parshant
    6 years ago

    PAULEM,

    There are two ways to get the messages id from context object.

    Your condition would be like below code.

    <#if env.context.message?? >
      <#assign msg_id = env.context.message.uniqueId />
    <#else>
      <#assign msg_id = page.context.message.uniqueId />
    </#if>

     

    You can get the ID of the currently rendered message
    ${page.context.message.id}
    ${env.context.message.id}

    You can get the unique ID of the currently rendered message
    ${page.context.message.uniqueId}
    ${env.context.message.uniqueId}