none
What is the simplest way of removing the diacritics in this case. RRS feed

  • Question

  • We have a simple FIM case.

    Users are entered/created/edited on the Portal Form and new users should be provisioned to AD.

    My difficulty is that we have many users who have accented characters in first and last name. e.g. Åke Bäckström,  Peter Örn, Päivi Mehilainen

    The AD outbound sync rule wants to create the AD displayName as lastname blank firstname      NO Problem with accents here.

    The AD outbound sync rule needs to build the DN as CN=firstname lastname,OU=....

    where in commonName attribute we want the accents stripped out of first and last names

    e.g. CN=Ake Backstrom,OU=....  


    We prefer Sync Rules to classic rules but we are flexible.

    Is there an inbuilt FIM function callable from the SyncRule to do this?

    What options do we have?

    Tuesday, January 22, 2013 11:54 AM

All replies

  • For as far as I know it, you would need to create your own function. This depends on the character sets used and the required translations needed. i.e. an Ö must be translated to what o, eu or something else. For some characters there are translation tables available but not for all.
    Tuesday, January 22, 2013 12:16 PM
  • If you know how to write C#, you could maybe use my Code Run activity and write some code / regex to replace values and keep the "cleaned" value in a seperate attribute that you flow and use to build a DN without diacritics..

    https://fimactivitylibrary.codeplex.com/wikipage?title=Code%20Run&referringTitle=Home

    Regards, Soren Granfeldt
    blog is at http://blog.goverco.com | twitter at https://twitter.com/#!/MrGranfeldt

    Tuesday, January 22, 2013 7:07 PM
  • This sounds interesting.

    When I look at a sync rule I see under the Function dropdown there are some builtin functions e.g. EscapeDNcomponent.

    What are the steps to write a function and then make such a beast visible to a Sync Rule. I have seen many how-tos re Custom Workflow Activity but none about extending FIM functions callable from a SyncRule.

    *HH

    Wednesday, January 23, 2013 7:21 AM
  • You can't extend the functions in Sync Rule as of now. However, you could do something a long this path -

    1) Extend the FIM Service schema to create a new attribute, i.e. DisplayNameWithoutDiacritics

    2) Refresh schema on FIM MA and create a metaverse attribute to hold the new attribute

    3) Create an import flow for the DisplayNameWithoutDiacritics for the FIM MA to the metaverse attribute

    4) Create a custom workflow that removes diacritics (you can use my Code Run workflow) and populates the DisplayNameWithoutDiacritics

    5) Change your Sync Rule to use the DisplayNameWithoutCiacritics to construct the DN

    Hopefully you get the big picture, even though there are a few more clicks involved :-)


    Regards, Soren Granfeldt
    blog is at http://blog.goverco.com | twitter at https://twitter.com/#!/MrGranfeldt


    Wednesday, January 23, 2013 8:16 AM
  •  private static string NormalizeDiacriticChars(string input)
            {
                string str = input ;
                string[] chars = new string[]{",",".","/","!","@","#","$","%","^","&","*","'","\"",";","_","(",")",":","|","[","]","`"};
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < chars.Length; i++)
                {
                    if (str.Contains(chars[i]))
                    {
                        str = str.Replace(chars[i], "");
                    }
                }
                
                str = str.Normalize(NormalizationForm.FormD);
                for (int i = 0; i < str.Length; i++)
                {
                    UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(str[i]);
                    if (uc != UnicodeCategory.NonSpacingMark)
                    {
                        sb.Append(str[i]);
                    }
                }
                str = sb.ToString().Normalize(NormalizationForm.FormC);
                return (str);
            }
    The function above removes a lot of special characters and some "garbage" (chars array). This is not complete "ᴁȦȯ" are not converted for example. The function was sufficient for my use, I did try to find a more elaborated function but could not find it. The extra characters need to be substituted by your own substitution table.
    Wednesday, January 23, 2013 8:51 AM
  • Nice code, Fer.

    It looks like it could easily be converted to a Code Run function - see https://fimactivitylibrary.codeplex.com/wikipage?title=Code%20Run%20samples&referringTitle=Home


    Regards, Soren Granfeldt
    blog is at http://blog.goverco.com | twitter at https://twitter.com/#!/MrGranfeldt

    Wednesday, January 23, 2013 8:55 AM
  • I've used a similar approach of KD-normalizing an input string to bytes, then passing it through an ASCIIEncoder that discards anything not in its codepage.  A bit crude certainly, as one could argue that o-umlaut is properly "oe" and not "o", but it is usually adequate for building sAMAccountNames out of accented names with good assurance that the result characters will be manageable.

    Steve Kradel, Zetetic LLC SMS OTP for FIM | Salesforce MA for FIM

    Wednesday, January 23, 2013 8:28 PM
  • FYI - Kristian Thim has posted a Code Run sample for removing diacritics - https://fimactivitylibrary.codeplex.com/wikipage?title=Code%20Run%20samples&referringTitle=Code%20Run

    Regards, Soren Granfeldt
    blog is at http://blog.goverco.com | twitter at https://twitter.com/#!/MrGranfeldt

    Sunday, February 3, 2013 10:57 AM