Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
User avatar
By amosbatto
#822395
Inside a trigger, you can use this code to get the access token in version 3.2.2 or later:
Code: Select all
    require_once PATH_CONTROLLERS . 'designer.php';
    $designer = new Designer();
    $credentials = $designer->getCredentials();
It returns something like:
Code: Select all
array( 
    'access_token' => '8bd11f036a5b5eb9e98eb20d8c7375e29bc05fcc', 
    'expires_in' => 86400,
    'token_type' => 'bearer', 
    'scope' => 'view_processes edit_processes *', 
    'refresh_token' => '4e2b737f675a5a3a8b9a79b11ba8af40fd4e02e2', 
    'client_id' => 'xxxxxxxx',
    'client_secret' => 'xxxxxxxxx'
);
For more info, the file processmaker/workflow/engine/controllers/designer.php

If you are using an earlier version of PM, then see:
viewtopic.php?f=44&t=713519&p=795087#p795087
or you can use PMDynaform.getAccessToken() in a Dynaform's Javascript and save the value to a hidden field with an associated variable, so you can access it from a later trigger in the process.
The JavaScript would be:
Code: Select all
var token = PMDynaform.getAccessToken();
$("#myToken").setValue(token);
Then the subsequent trigger would be:
Code: Select all
$accessTkn = @@myToken;

That is what I'm doing I have 500+ variables so i […]

Primero, tus comillas estan mal y olvidaste termin[…]

First of all, you are using JavaScript, not Java. […]

Stop submit from javacript

Do it this way: form = $("#637207031573dcea[…]