This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Get User Account by email address

Hi,

I have an object that contains two properties related to this post. One is an email address that is pulled in via a mail source subject line into the email Address field when the object is created. The other property User (Value List of Users). I want to create an automatic value for the User Property I created (the property is called internal customer name and uses the User Value List).

So I have an email address from the email that creates the object. All of these emails come from M-Files users, therefore, the email address that it pulls in should match a login account.

I want to create a script for the automatic value of the Internal Customer Name(M-Files User) based off of the email address that the email comes from. I have written some code for the automatic value of this property, but nothing seems to be happening when it recalculates. Any help would be appreciated.

Option Explicit

'Get the Email from current object
dim Email : Email = vault.objectpropertyoperations.getproperty(Objver, 1798).value.displayvalue



Dim i, j, Account, User, UserAccount, UserName


for i = 1 to Vault.UserOperations.GetLoginAccounts.Count


	if Vault.UserOperations.GetLoginAccounts.item(i).EmailAddress = Email then

	
	for j = 1 to Vault.UserOperations.GetUserAccounts.count

		if Vault.UserOperations.GetUserAccount.item(j).LoginName = Vault.UserOperations.GetLoginAccounts.item(i).AccountName then

			
		
			output = Vault.UserOperations.GetUserAccount.item(j).LoginName
			
		end if
	next
		
	end if


next