Add helperProcessRequestId Attribute to Processes Properties by sanjacornelius · Pull Request #6170 · ProcessMaker/processmaker
This PR adds a new attribute helperProcessRequestId to the processes properties object. This attribute will enable the PLG team to reference the helper process request id that initiated the creation of the guided template process.
How to Test
- Run a Guided Template helper process.
- Upon completion, check the database for the newly created process in the
processestable. - Navigate to the
'properties'column. - Ensure in the object a new
helperProcessRequestIdis set. - Take note of the newly created process id.
- In your environment, create a new PHP script.
- Paste the below provided code snippet.
- Replace the
[NEW_PROCESS_ID]placeholder in the$guzzleApivariable with the actual newly created process id. - Run the script.
- Ensure the
helperProcessRequestIdis returned.
Code Snippet:
<?php
$guzzleClient = new \GuzzleHttp\Client(['base_uri'=> $_SERVER['HOST_URL'],'verify' => false]);
$guzzleOptions['headers']['Accept'] = 'application/json';
$guzzleOptions['headers']['Authorization'] = 'Bearer ' . getenv('API_TOKEN');
$processId = $data["_request"]['process_id'];
$guzzleApi = '/api/1.0/processes/[NEW_PROCESS_ID]';
// Get the helper process request ID stored in the process properties
$res = $guzzleClient->request("GET", $guzzleApi, $guzzleOptions);
$process = json_decode($res->getBody(), true);
$helperProcessRequestId = $process['properties']['helperProcessRequestId'];
return ["helperProcessRequestId" => $helperProcessRequestId];
Related Tickets & Packages
ci:next
ci:deploy
Code Review Checklist
- I have pulled this code locally and tested it on my instance, along with any associated packages.
- This code adheres to ProcessMaker Coding Guidelines.
- This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
- This solution fixes the bug reported in the original ticket.
- This solution does not alter the expected output of a component in a way that would break existing Processes.
- This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
- This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
- This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
- This ticket conforms to the PRD associated with this part of ProcessMaker.