Skip to main content
The GET method returns all the cases available to the current user as a JSON array. It needs two activities: GetCases, which builds the array, and GetCaseDetails, which supplies each case’s details.

Create the GET method

1

Start a new Service REST

Click Records → Integration Resources, right-click Service Package, and then click the Create command on the shortcut menu.
2

Specify the service details

On the form that opens, specify the following values, and then click Create and open.
3

Open the GET method

On the Methods tab, expand the GET method.
4

Create the response conditions

Click the Response tab and create the two conditions described in Response conditions.
After you have created the service, make sure that the URL of the service method is as follows:

Response conditions

Create the following two conditions on the Response tab.

pxIsInternalError

Parameter values:
  • Condition: When
  • When name: pxIsInternalError
  • Content type: application/json
  • Status code: Param.StatusCode
This condition sets no header fields and no message data.

Success response

Parameter values:
  • Condition: Default
  • Content type: application/json
  • Status code: Param.StatusCode
Header fields:
  • Name etag, with Map from set to Clipboard and Map from key set to Param.eTag
  • Name cache-control, with Map from set to Constant and Map from key set to "no-cache"
Message data:
  • Description: Response
  • Map from: Clipboard
  • Map from key: Param.Response

Create the GetCases activity

1

Create the variables

On the Parameters tab, create three variables:
  • result of type String
  • currentCaseId of type String
  • tempResult of type String
2

Get the list of available cases

Call Call pzGetCasesByFilter and select the Pass current parameter page option.pzGetCasesByFilter writes all the cases to myStepPage.
3

Loop over the returned cases

Create a step with a Property-Set method that returns cases from myStepPage in a loop.
  1. Add a loop and select For each element in value list.
  2. Specify the myStepPage.cases property.
  3. In the method parameters, set the Param.currentCaseID variable to myStepCase.cases(<CURRENT>).ID.
4

Get the details of each case

  1. Type Call GetCaseDetails on the Method tab.
  2. Type myStepPage.cases(<CURRENT>) in Step Page.
  3. Set the caseID parameter to Param.currentCaseID.
For the activity itself, see Create the GetCaseDetails activity.
5

Store the result as a string

Convert the result obtained in the previous step into a string and write it to the Param.tempResult variable.
6

Add the JSON separator

To generate a valid JSON string, add a comma to the Param.result parameter, which is Param.result + ",".In the When field, add the following two conditions:
  • If @IsParamBlank(tools,"result") is true, Skip Step. If the parameter is false, Continue Whens.
  • If @IsParamBlank(tools,"tempResult") is true, Skip Step. If the parameter is false, Continue Whens.
7

Append the case to the result

Check whether tempResult is empty. If it is not empty, add the value from tempResult to the main result, which is Param.result + Param.tempResult.
8

Build the final response

Create the final response "["+Param.result+"]" and write it to the Param.Response variable.

Create the GetCaseDetails activity

1

Create the variables

On the Parameters tab, create three variables:
  • caseID of type String
  • fileName of type String
  • listFileName of type String
2

Declare the page

Open the Pages & Classes tab and add a page named Case of the Work- class.
3

Open the case

On the Steps tab, type Obj-Open-By-Handle in the Method field. Add Case in the Step page field, and type Param.caseID in the InstanceHandle parameter.
4

Create the attachments property

Create a new .attachments property and populate it with the Case.pyAttachments list.
  1. Click the target icon on the right, and then click Create and open on the Create Property form.
  2. Select Page List as the property type.
  3. Type Link-Attachment in the Page definition field.
5

Populate the page with content values

Write Page-Copy to the Method field, Case to the CopyFrom field, and .content to the CopyInfo field.