Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
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;

Betvisa clone scripts are pre-built software solut[…]

A Bet365 Clone Script is essentially a ready-made […]

BC. Game Clone Script is a ready-made software sol[…]

A cryptocurrency exchange script is essentially pr[…]