How to pass variable value in a form

Hi @oronzo_lezzi,

I think setting userName on variables-fetched as in below code will solve your issue

<script cam-script type="text/form-script">
	
	inject([ '$rootScope', '$scope', function($rootScope, $scope) {

        camForm.on('variables-fetched', function() {
		  $scope.userName = $rootScope.authentication.name;
		});
        
	}]);
</script> 

https://docs.camunda.org/manual/7.12/reference/embedded-forms/lifecycle/

variables-fetched is fired after the request returns and the values of the variables have been merged into the variableManager.

1 Like