I've recently run into a challenge with an Enrollment Complete trigger workflow.
I want to run a bash script that uses osascript display dialog to prompt the current user for an asset tag after enrolling.
The script is thoroughly tested. It works from the command line. It works in a policy using self service, or a custom trigger.
However, if the policy is triggered by Enrollment Complete the script runs but it does NOT display the AppleScript dialog box.
I've simplified the policy for testing.
I setup one policy using the Enrollment Complete trigger and a custom trigger.
I use "Files and Processes > EXECUTE COMMAND"
/usr/bin/osascript -e "display dialog "Hello World"" >/dev/null 2>&1
According the to policy logs the policy runs during enrollment. The command runs but the osascript Display Dialog does not appear.
If I run the policy from the command line with the custom trigger it works.
I have also tried this with a full bash script using sudo -u "$currentUser" osascript
Thoughts?