Good day! Tell me, is it possible to get (and how) the ID of the current authorized camunda user at the start of the process via the REST API? Thanks!
Hi - I’m not exactly sure what you would like to achieve? You can store the initiator of the process in a variable as described here https://docs.camunda.org/manual/latest/reference/bpmn20/custom-extensions/extension-attributes/#initiator and return the variables when starting a process via REST using the parameter withVariablesInReturn. Not sure if this is what you are looking for, though?
Cheers
Dirk
Hello, thank you for the answer. I want to make sure that when I start the process, I know the ID of the user who is just trying to start the process. Attached a screenshot of the place where the user should already be known. Thanks!
Have you tried defining a variable for the initiator on the start event? The user who started the process will be stored in that variable. Does this help for your use case? If not, try to explain your use case a bit more.
Thank you for your attention to the problem. I found a solution. Once again, we had to get the user’s ID before they hit “Start”. Here’s the solution (The “test” variable will contain the ID of the potential user):
…
inject([’$rootScope’, function($rootScope) {
debugger;
$scope.userName = $rootScope.authentication.name;
$(’#test’).text(scope.userName)
}]);
$scope.open1 = function($event)
{
$event.preventDefault();
$event.stopPropagation();
$scope.dateFieldOpened1 = true;
};
$scope.open2 = function($event)
{
$event.preventDefault();
$event.stopPropagation();
$scope.dateFieldOpened2 = true;
};
var dataObject = $scope.dataObject = {
employee: $scope.userName
};
camForm.on(‘form-loaded’, function(){
var variableManager = camForm.variableManager;
variableManager.createVariable({
name: ‘application’,
type: ‘Object’,
value: dataObject,
isDirty: true
});
});
…
Hello, I am new to camunda and I have a similar issue. I want to get information about the user who started a process to give this specific user information about the outcome of the process later on. Could somebody tell me where the lines of code Arthur posted would be included in the process to fullfill there purpose? I do not necessarily need the information about the user before the process started it would be enough to get them at the first user task. So if there is a simpler way to do this I would appreciate it.
Hi @eMAiXeS,
the most easy way is tho that @dirk.budke described in his post. You can save the intiator in a process variable:
Hope this helps, Ingo
Yes that helps a lot! Thank you.