Skip to main content
To create a GET method for Cases:
  1. Create a new Service REST (click Records → Integration Resources, right-click Service Package, and then click the Create command on the shortcut menu).
  2. On the form that opens, specify Cases as the name of the service, customapi as the name of the package, v2 as the version of the package, and cases as the name of the URI template and click Create and open.
    Note: After you have created the service, make sure that the URL of the service method is as follows: https://Server_Name/prweb/PRRestService/customapi/v2/cases.
  3. On the Methods tab, expand the GET method.
  4. Click the Response tab and create two response conditions:

Process what

Parameter values

Header fields

Message data

pxIsInternalError

  • Condition: When
  • When name: pxIsInternalError
  • Content type: application/json
  • Status code: Param.StatusCode
  

Success response

  • Condition: Default
  • Content type: application/json
  • Status code: Param.StatusCode
  • Name: etag; Map from: Clipboard; Map from key: Param.eTag
  • Name: cache-control; Map from: Constant; Map from key: “no-cache
  • Description: Response
  • Map from: Clipboard
  • Map from key: Param.Response
After you have configured the method, you need to create a new activity named GetCases:
  1. On the Parameters tab, create three variables:
    • result of type String
    • currentCaseId of type String
    • tempResult of type String
  2. On the Steps tab, complete the following steps:
    1. Get a list of all the cases available to the current user. To do this, call Call pzGetCasesByFilter and select the Pass current parameter page option. pzGetCasesByFilter will write all cases to myStepPage.
    2. Create a step with a Property-Set method that will return cases from myStepPage in a loop. To do this, add a loop, and for this loop select the For each element in value list and specify the myStepPage.cases property. In the method parameters, set the Param.currentCaseID variable to myStepCase.cases(<CURRENT>).ID.
    3. Create a step that will get the details of the case. To do this, type Call GetCaseDetails on the Method tab and then type myStepPage.cases(<CURRENT>) in Step Page. Set the caseID parameter to Param.currentCaseID.
      Note: Instructions for creating a GetCaseDetails activity are provided below.
    4. Convert the result obtained in the previous step into a string and write it to the Param.tempResult variable.
    5. To generate a valid JSON string, add a comma to the Param.result parameter (i.e. 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.
    6. Check if tempResult is empty. If it is not empty, add the value from tempResult to the main result (i.e. Param.result + Param.tempResult).
    7. Create the final response ”[“+Param.result+”]” and write it to the Param.Response variable.
To create a GetCaseDetails activity:
  1. On the Parameters tab, create three variables:
    • caseID of type String
    • fileName of type String
    • listFileName of type String
  2. Open the Pages & Classes tab and add a page named Case of the Work- class.
  3. On the Steps tab, complete the following steps:
    1. In the Method field, type Obj-Open-By-Handle. In the Step page field, add Case. In the InstanceHandle parameter, type Param.caseID.
    2. Create a new .atachments property and populate it with the Case.pyAttachments list. To create an attachment property, click the target icon on the right, and then click Create and open on the Create Property form. Next, select Page List as the property type and type Link-Attachment in the Page definition field, .
    3. Populate the page with content values. To the Method field, write Page-Copy; to the CopyFrom field, write Case; and to the CopyInfo field, write .content.