How do I find out the user account id from an email ?

How do I find out the user account id from an email ?

I'm creating an employee register by using an API from our HR system (not Zoho People) and I want to link the zoho account of employees to this record. However I can't use the associated email and I can't find a way to get the account id.

For example :
varFindExisting.User_Profile=varEmployeeRecord.getJSON("humanReadable").getJSON("email");

Where User_Profile is a Zoho User field with the display type Email Address


And varEmployeeRecord.getJSON("humanReadable").getJSON("email"); will return the email address from the HR system.

When I run it I get the error :

Execution Failed
Unable to update the value to carFindExisting.User_Profile (Line xx)
Invalid user name found for User_Profile field

So I'm looking for how I can find out the username "zoho_cat7" from the associated email "cat@example.com"


I will be running this for all of our employees overnight so anything to do with the logged in user won't work