Forum Discussion
You should be able to get the root message id with one REST call using that env.context.message.uniqueId variable. It will look something like this:
/restapi/vc/messages/id/${env.context.message.uniqueId }/root
This will return the topic message of the entire thread. From that you can get the id.
You can also look at using the ${page.context.thread} variable. That should get you the entire thread (along with it's id) without doing a rest call. Just be careful where that call is made, it is only available on pages with threads like the ForumTopicPage. You probably want to test for null before trying to use it.
- xorrkaz14 years agoGenius
Thanks, Kaela! When I tried ${page.context.thread} I was getting back some Java .toString() type notation. I had to search around a bit to find the env stuff. Thanks for the REST URL. I was hoping for a Freemarker variable, but REST will certainly work.
- xorrkaz14 years agoGenius
FYI, here is what I see when I use ${page.context.thread}:
lithium.eval.velocity.ThreadTemplateModel@e25235
I imagine this is an Object. How can I access members of this object?
- KaelaC14 years agoLithium Alumni (Retired)
Yeah, it's returning you a thread object. I will go check if the knowledge base has doc for the thread object, but in the meantime here it is:
thread
NOTE: YOU CAN NOT CALL THIS DIRECTLY – calls like page.context.thread will return you a thread
Method Decription Example Version / Branch thread.board get the board for this thread ${page.context.thread.board}
9.10 thread.topicMessage get the topic message for this thread ${page.context.thread.topicMessage}
9.1.0 thread.discussionStyle get the discussion style for this thread ${page.context.thread.discussionStyle}
9.10 thread.webUi.url get the url to the web page for this thread ${page.context.thread.webUi.url}
9.1.0 If all you want is the thread id, I think this would work
${page.context.thread.topicMessage.id}
Related Content
- 9 months ago
- 2 months ago
- 10 years ago
- 2 years ago
- 12 years ago