Here is what is happening. PMFCreateUser() is calling wsBase::createUser() which in turn calls RBAC::initRBAC(), which needs a valid user login. Since you are running a script task outside the user interface, there is no valid login.
The workaround is to web services in the trigger to login and then use the createUser() web service. That way you have a valid login when the script task is executed. Try using trigger code like this:
Code: Select all$baseUrl = "http://{$_SERVER['SERVER_ADDR']}:{$_SERVER['SERVER_PORT']}/sys" . @@SYS_SYS .
$client = new SoapClient($baseUrl . '/en/neoclassic/services/wsdl2');
$user = 'johndoe';
$pass = 'pAsSw0rD';
$params = array(array('userid'=>$user, 'password'=>$pass));
$result = $client->__SoapCall('login', $params);
if ($result->status_code != 0) {
throw new Exception("Unable to login to $baseUrl with user '$user' and password '$pass'.);
}
$sessionId = $result->message;
$params = array(array('sessionId'=>$sessionId, 'userId' => 'foobar',
'firstname'=>'Foo', 'lastname'=>'Bar', 'email'=>'foobar@example.com',
'role'=>'PROCESSMAKER_ADMIN', 'password'=>'fo0b@r'));
@@result = $client->__SoapCall('createUser', $params);