none
ReplaceString function to remove multiple special characters from sAMAccountName RRS feed

  • Question

  • I'm provisioning groups in AD an naming them according to DepartmentName in HR. off course HR uses & % \ / , and other fun stuff, so i need to do some regex before exporting DepartmentName to sAMAccountName. I'm doing the Regex on Import Sync. rule.

    CustomExpression: ReplaceString(NAVN,"/","") works fine, but this is only fixing the /'s what i need is something that can do:

    ReplaceString(NAVN,"/" or "\" or "," or "&","") but this apparently is not valid.

    Does any of you have a CustomExpression to do this "simple" action?


    /Frederik Leed

    Tuesday, June 25, 2013 8:52 AM

Answers

  • Hi Frederik,

    Without getting into a custom workflow activity, or potentially the FIM PowerShell Workflow Activity to have a PS script do the work for you, you will need a series of nested ReplaceString calls to strip out all those characters.

    E.g. ReplaceString(ReplaceString(ReplaceString(NAVN,"/",""),"\",""),",","") ...

    Personally, I think you would be better off creating an activity or PS script that would apply your regex or enumerate all characters in the DepartmentName and only keep the valid alpha-numeric characters.  You run the risk with the ReplaceString approach that HR uses a characters you're not looking for, you could define an invalid sAMAccountName.

    Cheers,

    Marc


    Marc Mac Donell, VP Identity and Access Solutions, Avaleris Inc.
    http://www.avaleris.com

    • Marked as answer by FrederikLeed Tuesday, June 25, 2013 6:44 PM
    Tuesday, June 25, 2013 12:54 PM

All replies

  • Hi Frederik,

    Without getting into a custom workflow activity, or potentially the FIM PowerShell Workflow Activity to have a PS script do the work for you, you will need a series of nested ReplaceString calls to strip out all those characters.

    E.g. ReplaceString(ReplaceString(ReplaceString(NAVN,"/",""),"\",""),",","") ...

    Personally, I think you would be better off creating an activity or PS script that would apply your regex or enumerate all characters in the DepartmentName and only keep the valid alpha-numeric characters.  You run the risk with the ReplaceString approach that HR uses a characters you're not looking for, you could define an invalid sAMAccountName.

    Cheers,

    Marc


    Marc Mac Donell, VP Identity and Access Solutions, Avaleris Inc.
    http://www.avaleris.com

    • Marked as answer by FrederikLeed Tuesday, June 25, 2013 6:44 PM
    Tuesday, June 25, 2013 12:54 PM
  • Excellent answer. I'm just going with the simple one for now.

    /Frederik Leed

    Tuesday, June 25, 2013 6:45 PM