Versions Compared

Key

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

Syntax

comalaSetState(pageIDpageId, workflowState, comment?<comment>)

Description

Sets the workflow state of the page using the Comala Workflows add-on.

Parameters

...

Parameter name

Type

Required

Description

json

pageId

string

number

Yes

The

JSON to be converted

selected page to change the workflow state on.

Return type

variable return type - depending on the left hand side operator type

Examples

Both examples show how JSON data can be parsed into an array or struct collections. Both examples use the following struct definitions:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

struct code {
    number [] rgba;
    string hex;
}
 
struct color {
    string color;
    string category;
    string type;
    code code;
}
 
struct colors {
    color [] colors;
}

Example 1 - Reading JSON from a file

16
17
18
19
20
21
22

string json = readFromTextFile("C:\\colors.json");
 
 
colors cData;
cData = fromJson(json);
 
return cData.colors[0].color;

Example 2 - Reading JSON from a variable

16
17
18
19
20
21

string json = "{\"colors\":[{\"color\":\"red\",\"category\":\"hue\",\"type\":\"primary\",\"code\":{\"rgba\":[255,0,0,1],\"hex\":\"#FF0\"}}]}";
 
colors cData;
cData = fromJson(json);
 
return cData.colors[0].color;

See also

...

Page:
httpGet

...

Page:
httpDelete

...

Page:
httpOptions

...

Page:
httpPatch

...

Page:
httpPost

...

Page:
httpPut

...

Page:
httpCreateCookie (Cloud)

...

Page:
httpGet (Cloud)

...

Page:
httpGetErrorMessage (Cloud)

...

Page:
httpDelete (Cloud)

...

Page:
httpCreateParameter (Cloud)

...

Page:
httpCreateHeader (Cloud)

...

Page:
httpBasicAuthHeader (Cloud)

...

Page:
fromJson (Cloud)

workflowStatestringYesName of the workflow state to be set to.
commentstringnoComment to be added to the Comala workflow history.

Return type

Boolean (true/false)

Examples

Code Block
languagejava
linenumberstrue
return comalaSetState(getPage("TST", "Demo Page"), "Approved", "Page was approved by: " + currentUserFullName());