I've been banging my head against this issue of trying to get User Input when running a script in Self Service for machines with Mac OS 10.14.
The script below shows a working proof of concept. You do get prompted to allow Jamf to access Finder. That can be overcome with a pppc - links to more info in the script comments.
Feel free to comment/improve
#!/bin/bash
# GetUserInputFromSelfService.bash
# Proof of concept
# Applescript query inside bash script. Used as a building block to get user info from a script run in JAMF Self Service
# David London - Shamelessly hacked from a much bigger script by James Toher
# On 10.14 onwards the user will either have to allow Jamf to access Finder or a PPPC Configuration Profile will need to be installed prior to running this
# A good pppc is:
# https://github.com/rtrouton/privacy_preferences_control_profiles/tree/master/Privacy%20Settings%20Whitelist%20-%20Jamf%20Notifications
# you will need tccprofile.py to make it
# https://github.com/carlashley/tccprofile
# Richard Trouton as always is a font of knowledge https://derflounder.wordpress.com/2018/08/31/creating-privacy-preferences-policy-control-profiles-for-macos/
# 2019-10-23
user_entry=""
while [ "$user_entry" = "" ] ; do
user_entry=$(osascript -e '
tell application "Finder"
activate
try
display dialog "Please enter something" with title "Entry of something demo" default answer ""
set user_entry to the (text returned of the result)
on error number -128
set user_entry to ""
end try
return user_entry
end tell')
done
# do something with $user_entry
exit 0