...
Code Block |
---|
language | java |
---|
linenumbers | true |
---|
|
//create structs for JSON
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") { //exclude from archive space
//Create request
HttpRequest request;
HttpHeader authHeader = httpBasicAuthHeader("admin", "admin");
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") { //checks the current 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
}
} |
Info |
---|
This script uses the Comala REST API to get the current state of the workflow. Once the getComalaState() routine is developed the first 29 lines of code will be removed. The script using the new routine would look like this: Code Block |
---|
|
language | java |
---|
linenumbers | true |
---|
|
if(space != "AS" AND getComalaState() && 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) |
---|
showLabels | false |
---|
showSpace | false |
---|
cql | label = "pagescomala" |
---|
|
See More Documentation
Filter by label (Content by label) |
---|
showLabels | false |
---|
showSpace | false |
---|
cql | label = "page_routines" |
---|
|