There are two ways that I have seen to address this - and personally I have a preference for one of those methods, but you can decide which works best for you.
First, it's important to understand a couple of things.
The View agent on the VM will capture information about the client and store that data in the hive "HKCU\Volatile Environment\" and one of the keys in that hive is "ViewClient_Machine_Name".
Citrix clients store the CLIENTNAME attribute in "HKLM\Software\Citrix\ICAClient\CLIENTNAME".
By default, the Citrix plugin installs with dynamic client name enabled. This means that the CLIENTNAME reg is populated with the host name of the host running the client. In other words, by default CLIENTNAME will be the VM's OS host name.
One method of changing the CLIENTNAME to the endpoint host name is to grab the reg key "ViewClient_Machine_Name" and replace the "CLIENTNAME" key with that string. A script to do just that may look like this:
You would want this script to run on connection and reconnection, so when a roaming desktop user changes endpoints you are updating the CLIENTNAME to match for location awareness.
To use this method, you would need to reinstall the Citrix plugin on the VM to disable dynamic client name.
I like this approach because it's elegant and simple to troubleshoot. I would recommend using BGinfo to add three bits of info to the VM desktop wallpaper to help validate that the CLIENTNAME is correct and to aid in any troubleshooting. For example, I would have the following appear in the lower left corner in small font on the desktop:
View VM -
View Client -
Citrix Client Name -
The other method would be to leave Citrix dynamic client name enabled and change the host name of the VM on connect/reconnect to match the endpoint host name (or include the endpoint host name in the VM host name). I'm not a huge fan of this approach because it involves constantly changing the host name of the VM which could impact other applications as well as complicate troubleshooting. You also need to make sure that the TCPIP name is changed as well, resulting in a DNS update if you're running dynamic DNS.
I do have access to a script to perform a VM host name change, but since I didn't write it I don't want to post it here. I will check with the author to see if I can add it to this post later, but the script above should give you a start on creating that script.