1 year ago

#353004

test-img

Lincolnmyth

How can I select a display page template for a webcontent article, programmatically in liferay?

I've been trying to create webcontent articles programmatically in liferay 7.3.5. I've succeeded in creating and updating them but adding a display page template hasn't been succesful. I use the method add-article from the JournalArticleServiceImpl class. This method says you can add a layoutUUID. But this doesn't seem to work.

So what i've been trying to do is using the method in javascript (add-article from journalarticleserviceimpl). In this method i give it a groupId, a folderId, a titlemap and description map, content in the form of xml and a ddm structure and template key. When retrieving a webcontent article that has a display page template, the layoutUUID is shown in the api/jsonws. Adding this same UUID to my method however doesn't actually do anything.

Here's my javascript attempt so far

Liferay.Service('/journal.journalarticle/add-article', {
groupId: 590594,
folderId: 591144,
 titleMap: {"nl_NL":" " + NLTitle + " ", "en_US":" " + ENTitle + " ", "uk_UA":" " + UKTitle + " "},
descriptionMap: {"nl_NL":" " + NLOmschrijving + " ", "en_US":" " + ENOmschrijving + " ", "uk_UA":" " + UKOmschrijving + " "},


content: "<?xml version=\"1.0\"?>\n\n<root available-locales=\"nl_NL,en_US,uk_UA\" default-locale=\"nl_NL\">\n\t<dynamic-element name=\"Categorie\" type=\"list\" index-type=\"keyword\" instance-id=\"ijcwmbgp\">\n\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + Categorie + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + Categorie + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + Categorie + "]]></dynamic-content>\n\t</dynamic-element>\n\t<dynamic-element name=\"Omschrijving\" type=\"text_box\" index-type=\"text\" instance-id=\"eqtlrvcp\">\n\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + NLOmschrijving + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + ENOmschrijving + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + UKOmschrijving + "]]></dynamic-content>\n\t</dynamic-element>\n\t<dynamic-element name=\"BenodigdAantal\" type=\"ddm-integer\" index-type=\"keyword\" instance-id=\"ifsdllnv\">\n\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + BenodigdAantal + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + BenodigdAantal + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + BenodigdAantal + "]]></dynamic-content>\n\t</dynamic-element>\n\t<dynamic-element name=\"locatie\" type=\"text\" index-type=\"keyword\" instance-id=\"fuvfqqkm\">\n\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + locatie + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + locatie + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + locatie + "]]></dynamic-content>\n\t</dynamic-element>\n\t<dynamic-element name=\"BeginDatum\" type=\"ddm-date\" index-type=\"keyword\" instance-id=\"fzchaapv\">\n\t\t<dynamic-element name=\"BeginTijd\" instance-id=\"knwubviu\" type=\"text\" index-type=\"keyword\">\n\t\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + BeginTijd + "]]></dynamic-content>\n\t\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + BeginTijd + "]]></dynamic-content>\n\t\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + BeginTijd + "]]></dynamic-content>\n\t\t</dynamic-element>\n\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + BeginDatum + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + BeginDatum + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + BeginDatum + "]]></dynamic-content>\n\t</dynamic-element>\n\t<dynamic-element name=\"EindDatum\" type=\"ddm-date\" index-type=\"keyword\" instance-id=\"zkqkyjxx\">\n\t\t<dynamic-element name=\"EindTijd\" instance-id=\"opqvwklb\" type=\"text\" index-type=\"keyword\">\n\t\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + EindTijd + "]]></dynamic-content>\n\t\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + EindTijd + "]]></dynamic-content>\n\t\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + EindTijd + "]]></dynamic-content>\n\t\t</dynamic-element>\n\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + EindDatum + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + EindDatum + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + EindDatum + "]]></dynamic-content>\n\t</dynamic-element>\n\t<dynamic-element name=\"Contactpersoon\" type=\"text_box\" index-type=\"text\" instance-id=\"lrjyrrlo\">\n\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + ContactInformatie + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + ContactInformatie + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + ContactInformatie + "]]></dynamic-content>\n\t</dynamic-element>\n\t<dynamic-element name=\"Status\" type=\"list\" index-type=\"keyword\" instance-id=\"fjplwrhe\">\n\t\t<dynamic-content language-id=\"nl_NL\"><![CDATA[" + Status + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"en_US\"><![CDATA[" + Status + "]]></dynamic-content>\n\t\t<dynamic-content language-id=\"uk_UA\"><![CDATA[" + Status + "]]></dynamic-content>\n\t</dynamic-element>\n</root>",

 ddmStructureKey: '602933',
 ddmTemplateKey: '602946',
},

Does anyone know of another method of doing this? Either in java or javascript

javascript

java

liferay

liferay-7

0 Answers

Your Answer

Accepted video resources