How to fix the same pageId issue which occurs when using @pageId@

Problem statement

This article explains how to fix the same pageId, which is used under certain circumstances using @pageId@.

Error message

When an action is run and has a file that contains copyPage as the first action and runFromPageList with modifyPage as the second action, we notice that the replacement variable @pageId@ of the second action runFromPageList is taking only the page id from the first action copyPage instead of iterating through all the pages in the space.

Commands used in the text file:

  • CLI action:

    acli --action run --file myactions.txt


  • myactions.txt:

    myconfluence --action copyPage --id 1048612 --newSpace CON --parent 347996323 --targetServer "" --targetUser automation --targetPassword automation --replace -v myconfluence1 --action runFromPageList --space CON --common "--action modifyPage --id "@pageId@" --special "" # ~"" --findReplaceRegex ""(?m)<(?-s).*=""scroll-ignore""(?s).*<(?-s).*macro>#""" -v


  • Verbose Logs:

    ACLI appfireuser001$ acli --action run --file myactions.txt Run: myconfluence --action copyPage --id 1048612 --newSpace CON --parent 347996323 --targetServer "" --targetUser testuser --targetPassword **** --replace -v URL requested: Request type: GET Content type: application/json; charset=utf-8 Response code: 200, message: null, url: Successful login to: null by user: automation Run: --action modifyPage --id "347996349" --special " # ~" --findReplaceRegex "(?m)<(?-s).*="scroll-ignore"(?s).*<(?-s).*macro>#" Page 'test_scroll_4' in space CON modified. Page has id 347996349. Run: --action modifyPage --id "347996349" --special " # ~" --findReplaceRegex "(?m)<(?-s).*="scroll-ignore"(?s).*<(?-s).*macro>#" Content has not changed. Page is 'test_scroll_4' in space CON. Page has id 347996349 Run completed successfully. 2 actions were successful Run completed successfully. 2 actions were successful from file '/Users/appfireuser001/ACLI/myactions.txt'. ACLI appfireuser001$



The @pageId@ is being substituted from the copy action BEFORE the runFromPageList runs. It will help if you defer the substitution until the runFromPageList runs. This is because both actions are already in a run script.

We need to move the action copyPage into a run action, as shown below and then use the runFromPageList action to modify the page. Please see the last two sample actions for reference.