Comment 7 for bug 877752

After a little modification your solution seams to work, type must also be included:
conn=$(nmcli -t -f UUID,TYPE,NAME con list | grep wireless | grep -e "$ap$" | awk -F\: '{print $1}')

I'll see if the result shows up on soon.

I think this would be a good fix as it's not too uncommon that your company wireless and VPN have similar names.