I have a form where customer items are created, and during this time I've been writting my code for the triggers using VSCode. The trigger's function is to send data collected from the form to an external api using php cURL but the thing is that executing the trigger directly from the cli returns a 201 response, creating the contact without any issue, but whenever I place and execute the same trigger inside Processmaker(I set the trigger to execute after the dynaform), the process continues to the next step, no error code is given, but the customer doesn't appear on the api. I have read and configured the debbugger as best I could, but since there is no real error, I never get a clue about what could be happening.
Two things to note:
1. Since some fields are dependant on external data, I am hardcoding the values, just to test.
2. I will not be posting the url nor the Authorization for security reasons, but as I said, everything is there and working when outside PM.
This is the trigger I am referring to:
$contactEmail = @@formContactEmail; $contactReseller_id = 2; $dataArray = array( "email" => "[email protected]", //$contactEmail, "reseller_id" => $contactReseller_id ); $ch= curl_init(); $uri = $url; $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($dataArray), CURLOPT_URL => $uri, CURLOPT_HTTPHEADER => array("Content-Type: application/json", "Authorization:") ); curl_setopt_array($ch, $options); curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch);
After reading and searching for more info, I am now wondering if the trigger must be called in any way: Do I need to do something more to call the trigger? I just placed it after the dynaform and the debugger is also showing it whenever I run the process so I suspect this is not the issue, but I am not sure. Thank you again!