Solution
From the Online Help
/myUser/... This property can be used only if the current session is associated with: the predefined "admin" user, a user defined as "local", or a user defined by a Directory Provider (LDAP or ActiveDirectory). This property cannot be used if the user is a "project principal", which is normally the case when running inside a Commander step. For example, with an interactive login you can use: ectool getProperty /myUser/userName (to get the user name of the logged in user, or...) ectool getProperty /myUser/email (to get the email address)
Examples
# Get the current userName # This has to be handled differently if this code is running from within a Commander Step vs. externally. # The property /myUser/userName can only be used when NOT in a Commander Step. # In that case, use the property /myJob/launchedByUser. use strict; use ElectricCommander; my $ec = ElectricCommander->new(); my $userProperty = ''; if($ENV{'COMMANDER_JOBSTEPID'}) { $userProperty = '/myJob/launchedByUser'; } else { $userProperty = '/myUser/userName'; } my $xpath = $ec->getProperty($userProperty); my $currentUser = $xpath->findvalue('//value')->string_value; print "currentUser = $currentUser\n";