Forum Discussion
8 Replies
- angelaCatalyst II
I wished Aras would have a standard function for this common task. But they haven´t. You have to do this with AML:
// Get user Alias Identity
Item alias = inn.newItem("Alias","get");
alias.setProperty("source_id",inn.getUserID());
alias.setAttribute("select","related_id");
alias = alias.apply();
string identity = alias.getProperty("related_id");- QuietCloundsIdeator II
Thank you so for your reply. I found out that there is a relationship "Alias" connect "User" and "Identity" Will test it.
Best!
- DaanTheodenCreator III
Thank you this time angela!
- angelaCatalyst II
Some update to this one, cause this post is about a common task everybody needs to solve sometimes.
Even if an Aras employee (Chris "the saint" [emoticon:44ce83dd2c0841729633d585605ccf2e]) and many other liked my code sample, I wonder if we all have overseen a better solution.
Doesn´t inn.getUserAliases()); do pretty much the same?!?!? Does anyone know more? I am so confused right now.
- little_legendCreator II
I know that the question is a little bit old, but in the newer versions you can try this code (for C#) [emoticon:c4563cd7d5574777a71c318021cbbcc8]
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:d5e46790-754f-4456-a1d2-679025cf8013:type=csharp&text=string%20userIdentityId%20%3D%20CCO.Identity.GetIdentityIdByUserId%28inn.getUserID%28%29%29%3B]
- angelaCatalyst II
That´s an excellent one - thank you!!![emoticon:1435ff2429184e17bc948e4f19178e1e] Seems to be a very uncommon function, I just found one reference in Innovator at all. But it´s so obviously useful! Finally somebody found the solution to a 5 year old puzzle!!
- alderaanIdeator III
In C# there is
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:e2beef72-9c93-47a9-96b2-3836df04f639:type=text&text=string%20aliasId%20%3D%20Aras.Server.Security.Permissions.Current.AliasIdentitiesList%3B]
But you would probably need to check if it contains exactly one id, since it is a "List".
In Javascript there is:
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:d7e55918-f2f3-4d13-beee-15c10dfabeda:type=text&text=aras.getIsAliasIdentityIDForLoggedUser%28%29]
- angelaCatalyst II
Hi Alderaan,
many thanks for the examples! I like both variants and will definitely use them!