Forum Discussion
I think there is an error when creating the user list.
var userlist users =
ToUserList(
// extracts the text between parentheses in [SME] and appends the email domain
ToText(Part(Part([SME], 2, "("), 1, ")") & "@somecompany.com"),
//record owner
[Record Owner]
);
When making your user list, why are we appending [Record Owner] to that list and then checking if the record owner is in the list? That's like saying, check if Record Owner is included in Record Owner, thus, everything is checked. Remove the [Record Owner] from the user list above.
------------------------------
Mike Tamoush
------------------------------
How do you write it in such a way that you compare the SME field, converted into a user list, to the record owner without including the record owner as part of the userlist field?
------------------------------
MICHAEL SARGENT
------------------------------
- MikeTamoush2 years agoQrew Elite
The Record Owner should not need to be a user list.It's as if you have a list of letters:
A,B,C,D and you want to check if a single letter is within that list. You would just do:
contains([Letter List], "B")
In your case:
contains($Userlist, [Record Owner])
------------------------------
Mike Tamoush
------------------------------ - MikeTamoush2 years agoQrew Elite
Though, I am not convinced your Userlist is correct. Can you make a formula userlist, and just see if you are getting the list of users as expected? In the past, for me I had to do something more involved to break apart a text list and then reconvert it into a bunch of users. Since you do not actually need the users as a user field, I would just compare text strings. ie:
If you already have a text list of names, I wouldn't even bother converting them into anything. So, you have a list like this:
michael sargent (ms1234), jason vorhees (jv2345). Lets call that [User Text List].
You also have a Record Owner. If we do:
var text OwnerEmail = UsertoEmail([Record Owner]
and the Owner is Michael, that would look something like this: ms1234@yourcompany.com.
If you did this: Left($OwnerEmail, "@"), that should give you: ms1234
So if we put that all together:
var text ListofNames = [User Text List];
var text OwnerEmail = UsertoEmail([Record Owner];
var text ExtractUserIDfromEmail = Left($OwnerEmail, "@");Contains($ListofNames, $ExtractUserIDfromEmail)
I think this should give you what you are looking for.
------------------------------
Mike Tamoush
------------------------------