Question

Unable to Change Stage using PUT Update api

Hello,

We are trying to integrate with another system and want to allow that system to change the stage of our process.

We are not able to find what should be sent in the body of the request to use pyChangeStage actiondId.

Url look like this : https://pega/prweb/api/v1/cases/XWY-WORK OFFER-7?actionID=pyChangeStage

Content-Type, If-Match are defined and working.

Looking at the audit log of the case and by tracing the request we see that pyChangeStage is called but without any parameters.

For now the body look like this :

{
"content": {
"AuditNote": "Jumped because not needed anymore responded-Sush",
"UserAuditNote":"Jumped because not needed anymore responded-Sush",
"ChangeToStage": "Approval Rejection",
"pyGotoStage": "Approval Rejection",
"ChangeToNextStage": "goto"
}
}

Could you help us understand what should be sent?

Thank you,

Loïc

Correct Answer
August 5, 2019 - 4:21pm

Hi Loic,

Use this body. You have to use pyChangeStageOption and not ChangeToNextStage. You can retreive the good property directly in the flow action pyChangeStage

{

    "content": {

        "pyAuditNote": "Jumped because not needed anymore responded-Sush",

        "pyChangeStageOption":"goto",

        "pyGotoStage": "Approval Rejection"

    }

}

Regards,

Comments

Keep up to date on this post and subscribe to comments

August 5, 2019 - 4:21pm

Hi Loic,

Use this body. You have to use pyChangeStageOption and not ChangeToNextStage. You can retreive the good property directly in the flow action pyChangeStage

{

    "content": {

        "pyAuditNote": "Jumped because not needed anymore responded-Sush",

        "pyChangeStageOption":"goto",

        "pyGotoStage": "Approval Rejection"

    }

}

Regards,

August 6, 2019 - 4:59am
Response to kevin.fages

Hello Kevin,

Thank to your response it's now working.

For people that want to know how to get those information, there are two way :

1/ go to the change stage view with Live UI and find the fields used.

2/ use API to get the fields :

Method : PUT

https://hostname:443/prweb/api/v1/cases/CaseID-15/actions/pyChangeStage/refresh

Body : "{}"

The API response will be the description of the action view with all the fields and the logic associated.

{
  "view": {
    "reference": "",
    "validationMessages": "",
    "viewID": "pyChangeStage",
    "visible": true,
    "name": "Change stage",
    "appliesTo": "XYW-Offers",
    "groups": [
      {
        "layout": {
          "visible": true,
          "containerFormat": "NOHEADER",
          "groups": [
            {
              "layout": {
                "visible": true,
                "titleFormat": "",
                "containerFormat": "NOHEADER",
                "groups": [
                  {
                    "field": {
                      "validationMessages": "",
                      "visible": true,
                      "labelReserveSpace": false,
                      "readOnly": false,
                      "control": {
                        "modes": [
                          {
                            "modeType": "editable",
                            "controlFormat": "",
                            "listSource": "locallist",
                            "textAlign": "Left",
                            "options": [
                              {
                                "value": "Next stage",
                                "key": "next"
                              },
                              {
                                "value": "Choose a stage",
                                "key": "goto"
                              }
                            ],
                            "tooltip": "",
                            "maxChars": "",
                            "formatType": "none",
                            "specifySize": "auto",
                            "minChars": ""
                          },
                          {
                            "modeType": "readOnly",
                            "tooltip": "",
                            "showReadOnlyValidation": "false",
                            "formatType": "none"
                          }
                        ],
                        "actionSets": [
                          {
                            "actions": [
                              {
                                "action": "refresh",
                                "refreshFor": "pyChangeStageOption"
                              }
                            ],
                            "events": [
                              {
                                "event": "change"
                              }
                            ]
                          }
                        ],
                        "type": "pxDropdown"
                      },
                      "label": "",
                      "type": "Text",
                      "required": false,
                      "reference": "pyChangeStageOption",
                      "labelFormat": "Standard",
                      "disabled": false,
                      "testID": "2015011414260802724494",
                      "value": "",
                      "maxLength": 0,
                      "expectedLength": "",
                      "fieldID": "pyChangeStageOption"
                    }
                  },
                  {
                    "field": {
                      "visible": false,
                      "disabled": false,
                      "fieldID": "pyGotoStage"
                    }
                  },
                  {
                    "field": {
                      "visible": false,
                      "disabled": false,
                      "fieldID": "pyNextStage"
                    }
                  },
                  {
                    "field": {
                      "visible": false,
                      "disabled": false,
                      "fieldID": "pyGotoStage"
                    }
                  }
                ],
                "groupFormat": "Inline middle",
                "layoutFormat": "SIMPLELAYOUT",
                "title": ""
              }
            },
            {
              "field": {
                "validationMessages": "",
                "visible": true,
                "labelReserveSpace": true,
                "readOnly": false,
                "control": {
                  "modes": [
                    {
                      "modeType": "editable",
                      "controlFormat": "Standard",
                      "textAlign": "Left",
                      "tooltip": "",
                      "maxChars": "",
                      "formatType": "text",
                      "specifySize": "auto",
                      "obfuscated": false,
                      "minChars": ""
                    },
                    {
                      "modeType": "readOnly",
                      "tooltip": "",
                      "showReadOnlyValidation": "false",
                      "formatType": "none"
                    }
                  ],
                  "actionSets": [],
                  "type": "pxTextArea"
                },
                "label": "Audit note",
                "type": "Text",
                "required": false,
                "reference": "pyAuditNote",
                "labelFormat": "Standard",
                "disabled": false,
                "testID": "20150114142608029911503",
                "value": "",
                "maxLength": 0,
                "expectedLength": "",
                "fieldID": "pyAuditNote"
              }
            }
          ],
          "groupFormat": "",
          "layoutFormat": "SIMPLELAYOUT"
        }
      }
    ]
  },
  "caseID": "CaseID",
  "name": "Change stage",
  "actionID": "pyChangeStage"
}

 

Thank you for your help.