Reordering pages in LIFERAY forms


So you’ve created your form with multiple pages and you’re asked to swap the order of pages one and two…

Err, if I click on the ellipsis here… or the edit menu there… OK, I’m out of ideas. There’s really nothing obvious that I could find to move the pages around and once I got to about 20 minutes of searching the googles, I figured it would be much quicker to do it the hard way…

We’re using:

  • Liferay Community Edition Portal 7.0.3 GA4 (Wilberforce / Build 7003 / June 19, 2017)
  • PostgreSQL 10.0.0


I’m going to go through the process I followed to work out how to resolve this but the “TLDR” answer is that you need to manipulate the JSON that represents your form in the DDMStructureLayout table.

Given that all of the data for the form is stored somewhere in the database, the first thing to do is find the table in which it’s stored.

Open the form for edit in Liferay and make a very obvious change to any field but don’t click the “Save” button. For example, change the text on a field to “here_i_am”.

Now, update the postgres.conf file to log everything and reload the config within PGAdmin 4. An easy way to do this is set the following line (make sure to remove the # at the beginning of the line):

log_min_duration_statement = 0 # -1 is disabled, 0 logs all statements

To reload the config, in PGAdmin, right-click on the Server (1) and select the “Reload Configuration” option (2):


Now, click “Save” on the Liferay form, then find the latest PostgreSQL log file. In postgres 10, within the data folder, you’ll find a file called “current_logfiles”. In this file will be the name of the current log file. Open it and search within it for your keyword (e.g. “here_i_am” from the example above).

The line you find should start with something along the lines of:

2017-10-23 18:04:24.657 BST [4444] DETAIL: parameters: $1 = 'some_uuid...

There are 2 bits of information you need from here:

  1. The uuid immediately following the $1
  2. The name of the table from the line immediately preceding your “DETAIL” line

The second line will start something like:

2017-10-23 18:04:24.657 BST [4444] LOG: duration: 0.106 ms bind <unnamed>: insert into

The name of the table will follow the “insert into” and in our case is “DDMStructureLayout”.

Now, within PGAdmin, you should run the following query:

SELECT * FROM DDMStructureLayout
WHERE uuid_ = 'my_uuid'

Replace my_uuid with the uuid that you found in the postgres log.

At this point, it’s worth shutting down Liferay as we don’t want to confuse it by changing the ground underneath it and we’ll need to restart it later to make the change take effect anyway.

The output will include a “definition” column which contains a JSON representation of your form. Copy that value into the editor of your choice and it should look something like this (line formatting added for clarity):

    "pages": [
        { "description": { "en_US": "page 1" }, "rows": [{ "columns": [{ "size": 12, "fieldNames": ["SomeFieldOnPage1"] }] }], "title": { "en_US": "PAGE 1" } },
        { "description": { "en_US": "page 2" }, "rows": [{ "columns": [{ "size": 12, "fieldNames": ["SomeFieldOnPage2"] }] }], "title": { "en_US": "PAGE 2" } }
    "paginationMode": "",
    "defaultLanguageId": "en_US"

Simply put, you’ll want to move the contents of the “pages” array around to get your pages in the desired order, like this:

    "pages": [
        { "description": { "en_US": "page 2" }, "rows": [{ "columns": [{ "size": 12, "fieldNames": ["SomeFieldOnPage2"] }] }], "title": { "en_US": "PAGE 2" } },
        { "description": { "en_US": "page 1" }, "rows": [{ "columns": [{ "size": 12, "fieldNames": ["SomeFieldOnPage1"] }] }], "title": { "en_US": "PAGE 1" } }
    "paginationMode": "",
    "defaultLanguageId": "en_US"

Now you’ll need to write this data back to the database by running the following query, again in PGAdmin:

UPDATE DDMStructureLayout
SET definition = 'json_structure'
WHERE uuid_ = 'my_uuid'

Obviously, you’ll need to replace ‘json_structure‘ with your edited form definition and ‘my_uuid‘ with the uuid you found in the postgres log.

Finally, restart Liferay and your form will now be in the right order.

And that’s that.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s