I didn't solve all but enough.
The script I got working looks like this:
#!/bin/bash
TEST=$(systemctl status licenseserver.service | grep "active (running)")
LENGTH=${#TEST}
NOTRUNNING=false
if (($LENGTH>0)) ; then
NOTRUNNING=false
else
NOTRUNNING=true
fi
echo "PA_FireActions($NOTRUNNING)"
Also bash variables in PA_Details should be enclosed in quotes:
echo "PA_Details(\"$TEST\")""PA_Details(\"$TEST\")"