You can use this option to create your own scheduled jobs. The following two sections are examples of jobs that you could create.
Add Label to Outdated Pages
As a worked example, we’ll add a label pages that haven’t been modified for one month in a particular space. You may do this if you need to ensure that content is kept current, although this solution is deliberately over-simplistic.
The query here selects pages (and only pages, not attachments, blog posts, comments etc) in the demonstration space that have not been modified for over 4 weeks. Look at the examples and refer to the CQL documentation if you need help.
Note that the number of hits from the query is shown. You should be careful that you don’t inadvertently select more content than you intended to. The user to run the query as is also shown highlighted.
Clicking Run now will run the service right now, so you can test (on a development instance ideally).
The content of the file in the screenshot is below - you can either copy it as an inline script, or put it on a file under a script root.
Line 8: Iterate over the items returned from the CQL
Line 19: Add label to the page
Add Comment to Outdated Pages
Alternatively you may wish to add a comment to any page that has not been modified for over three months, and has had no comment in over three months. This is very similar to the example above so refer to that for any missing information.
The query would be:
space = ds and type = page and lastModified < now("-14w")
CQL does not support searching on months or years, so multiply the weeks value appropriately.
The code is:
Line 9: check we don’t have a comment added within the last three months (in days)