Versions Compared

Key

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

This script will add a new label to all of the child pages of the selected parent pagemove a page to a space to be archived when the workflow is put into a specific state.

Code Block
languagejava
linenumberstrue
struct state {
    string name;
    string initial;
    string colour;
    string hideStates;
    string taskable;
    string changeDueDate;
    string final;
}

struct comalaState {
    string expand;
    string workflowName;
    state state;
    string [] messages;
}

if(space != "AS") {
    //Create request
    HttpRequest request;
    HttpHeader authHeader = httpBasicAuthHeader("jmuse", "M@tt_0518");
    request.headers += authHeader;
     
    //Post data and get response
    comalaState cs = httpGet("http://localhost:8090/rest/cw/1/content/" + id + "/status", request);
    
    
    if(cs.state.name == "Archive") {&& comalaGetState(id) == "Archive") { //exclude from archive space and check state
    
         addComment(id, "Moving page to archive space"); //adds comment to page
    number archiveHome = getPage("AS", "Archive Space Home"); //gets id of the archive spaces home page
    movePage(id, archiveHome); //moves page under the archive }space
}


See Other Recipes

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "pagescomala"

See More Documentation

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "page_routines"