Views:

Applies To:

GroupID 9 & above

Business Case:

We would like to create a Geographical dynasty based on the "location" attribute. We have a few values saved for the location attribute in Active Directory that have spaces in them, for example, Santa Clara, Hong Kong and New York. But when child groups are created, the DisplayName should ignore the spaces. For example, a child group should be displayed as TestDyansty-Honkong, TestDynasty-NewYork, etc.

What should we do to make sure that GroupID ignores the spaces in location names while constructing the display names of child groups?

Solution:

Follow these steps to address the spaces in location-based dynasty names.

  1. Create a Geographical dynasty with ‘location’ as the GroupBy attribute.

  2. Now open the properties of the parent dynasty and click the Options button.

  3. Click Edit Script.

  4. Uncomment line 7:

    args.FilterMethodName = "GroupByFilter"
  5. Add a script under the following function at line 12:

    Function GroupByFilter(Byval value as string) As string
     
        dim result as String = value.replace(" ","").replace("-","").replace(",","").Normalize(NormalizationForm.FormD)
    result = Regex.Replace(result, "\p{M}", "")
            return result
    End Function

  6. Compile the script and save the changes.

  7. Now update the parent dynasty and you will see that the spaces, commas, and hyphens that are part of the location name, are ignored in the dynasty name.