Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Unable to delete a ddmtemplate
Hi, there!I'm currently using Liferay Portal Version 7.1.3-GA4 and I'm experience a problem which has been reported for previous versions as well. This is the scenario: I create a custom structure, then a create a web template for this structure and finally I create a journal article. At some future moment I delete this article and try to delete the web template but then I get this error message "Error:The template cannot be deleted because it is required by one or more template links.". I check all the content in backend but there is no article using this template, Trash is empty as well. However, when I search my database I see tracks of this template id, in ddmtemplate and ddmtemplatelink tables for example. An important detail that I should mention is that my database was upgraded from lower Liferay version 7.1.2-GA3 to 7.1.3-GA4 and my structure, template and journal content were created before the update. Is it possible some old content versions that are linked with the target template were saved in the database but were not deleted unlike the last published version of the article?
Regards,
Eli
Regards,
Eli
1) Did you check the recycle bin? If the article is in the recycle bin, you can't delete the template
2) Please note that if you change an article and set a new template, old versions of the article might still reference that template
While 2) might not be too common, it happened a couple of times during development to us.
2) Please note that if you change an article and set a new template, old versions of the article might still reference that template
While 2) might not be too common, it happened a couple of times during development to us.
Hi, Christoph!Thanks for the reply! Yes, I think it is more likely the second case. Just the idea is how to manage this, because with deleted articles I think that the only option for now is to clear the database tracks manually. Or at least this is the only option until Liferay devs change this behavior.
Regards
Regards
Ok. So you have added a new template for existing content. Well, you either need to could click through all articles and remove the old article versions (in the history) or you can use a script to do that. It depends, how many articles you have.
Last time I had a similar issue, I used the server console to fetch all articles using JournalArticleLocalServiceUtil and check the ddmTemplate. Then I simply deleted the old versions using a script.
Last time I had a similar issue, I used the server console to fetch all articles using JournalArticleLocalServiceUtil and check the ddmTemplate. Then I simply deleted the old versions using a script.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™