James,
Thank you again. This is all incredibly helpful and educational. That did work, using the Xpath expression you suggested. The last little hurdle I need to clear is this: Updating the content entry in the database via updateJournalArticle works, but only renders after the user goes back into the control panel to republish the page. Even after the code executes (it seems) the values on the rendered page don't change with simple page refreshes. Someone else seems to have brought this up as well,
hereIn that thread Hitoshi Ozawa suggests that something might need to be done with the status of the article, but I am not sure how to get at that. Does that seems correct.
At any rate, with very few modifications from yours, and those mostly because of your suggestions, this is what I am currently using. It does
almost everything I need. I don't mean to keep pestering you (or anyone else who might be in earshot), but do you think there is some way to make it so that on page refresh the new value for my "SendEmail" field ("") renders?
1
2#if ($SendEmail.data == "true")
3 <!-- <link href="SERVICE_URL"> -->
4#set ($journalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))
5#set ($curArticle = $journalArticleLocalService.getArticle($groupId, $reserved-article-id.data))
6
7#set ($document = $saxReaderUtil.read($curArticle.getContent()))
8
9#set ($node = $document.selectSingleNode("//root/dynamic-element[@name='SendEmail']/dynamic-content"))
10
11#set ($newValue = "")
12
13#set ($V = $node.setText($newValue))
14
15#set ($V = $curArticle.setContent($document.asXML()))
16
17#set ($V = $journalArticleLocalService.updateJournalArticle($curArticle, true))
18
19#end
Ed
Please sign in to flag this as inappropriate.