Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Problem statement

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

Error message

When we run an action and have 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.

Code Block
acli --action run --file myactions.txt

...

Code Block
ACLI appfireuser001$ acli --action run --file myactions.txt 

Run: myconfluence --action copyPage --id 1048612 --newSpace CON --parent 347996323 --targetServer "http://abc.com" --targetUser testuser --targetPassword **** --replace -v

URL requested: http://abc.com/rest/api/latest/content/1048612?expand=space.homepage%2Ccontainer%2Chistory%2Cversion%2Cancestors%2Cmetadata.labels%2Cbody.storage&type=page&status=current
Request type: GET
Content type: application/json; charset=utf-8
Response code: 200, message: null, url: http://abc.com/rest/api/latest/content/1048612?expand=space.homepage%2Ccontainer%2Chistory%2Cversion%2Cancestors%2Cmetadata.labels%2Cbody.storage&type=page&status=current
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$

Solution

The @pageId@ is being substituted from the copy action BEFORE the runFromPageList runs. You need to defer the substitution until the runFromPageList runs. This is because both actions are already in a run script.

...