Workflows, Function Evaluator, and Activities


Basic Function Evaluator activity
(Building a Display Name)

So for a
Build Display Name Workflow Activity I would have a workflow with 3 potential
activities.

1. Trim(ProperCase(FirstName))                              [//Target/FirstName]

 

2.Trim(ProperCase(LastName))                              [//Target/LastName]

3. Build Display Name

  1. FirstName
  2. (Space)
  3. Last

 

This workflow Described above actually does 3 things, Proper cases the First Name and the last names of the object and saves it as the value of the First Name in the portal which can be synced to any Data source that the Metaverse is connected to but also builds the Display Name based on that information. If these activities were in separate workflows the First Name and the Last Name would have been Proper Cased but there is no guarantee that the Display Name would have been built correctly because there is no way of knowing which order that the workflows would have been completed.

 

Function Evaluator Activity using WorkflowData for Building an account name or mail alias

With this in mind how do we take values of an attribute and remove potentially characters that would be invalid for another attribute without directly affecting the attribute that we are building from. Let’s use the name O’Connors for example and let’s say we needed account names to be built without the character ‘ but we need to build this attribute value without having an impact on the actual last name. One way to complete this action would be to use WorkflowData,

Using the Default Function Evaluator it’s possible to perform complex actions such as removing special characters from a last name which may be needed to build another attribute which cannot use specific characters such as 

  • Account Name (samAccountNAme)
  • Mail Alias (mailNickname)
  • Display Name (displayName)

Depending on the system that the attributes will be used with, would depend on what characters are not accepted Such as

  • Active Directory
  • Exchange
  • O365

So now the idea is to remove Special characters such but not limited to the following

  •  (
  • )
  •  '
  •  ;
  •  -
  •  _
  • !
  • |
  •  ~

But some people are attached to their last names and would rather not have them changed but we still need to get the special characters removed from them so we can build the previously described attributes. So we will need to build a workflow that uses WorkflowData to build the values that can be set on the desired attributes without changing the source attributes

Here is an example on how we can build an account name based on the First Name and Last Name, removing the special characters without making changes to the actual Last Name.

Please keep in mind that this blog posting only describes the initial building of the Account Name and does not check for Uniqueness, there is another posting for Uniqueness Validation.

 

This part of the workflow is based on your default Workflow Activity that is available for use out of the box, the Function Evaluator

This workflow is built using 4 Activities within a single workflow as opposed to 4 separate workflows, Adding multiple activities to a single workflow to complete a function is the only way to ensure that the activities that are needed to perform a function happen in any specific order. For example if you had a workflow that was building the display name from First Name and Last Name and to build the Display Name the workflow would take the First name add a space and then apply the last name. But if you wanted the Display Name to be Proper Cased for example John Doe and the first name was entered either all Capital letters or all lower case letters you could potentially have JOHN DOE, john doe or any combination set as your Display Name. If you added 2 separate workflows to proper case the first name and last name there is no guarantee that the proper casing would happen in any specific order.

We are going to focus on the part of the workflow that fixes the value set for the last name in preparation of the value needed to be used to build the attribute that cannot take special characters.

In the example here we will focus on 4 special characters that we are trying to remove from the last name but you could repeat this process to add additional characters to be filtered if needed.

The first part of this workflow to remove special characters “fixLastName”

The Second Part takes the Workflow Data from the First and performs the same function with a different character

The next step continues this process taking the new WorkflowData that is built looks for the next character to remove.

And the next part continues this trend

It may be hard to see but the characters for each of the above activities in the following order are ‘ , -

You could repeat this process for as many special characters as needed that you would like to remove from the final value that you are building.

 

 

Quick Reference http://technet.microsoft.com/en-us/library/ff800820(v=WS.10).aspx

 

 

## http://blogs.msdn.com/connector_space ##

Comments (2)

  1. Andrew Masse says:

    Correction to my other comment:  $in should be $acctName

  2. Andrew Masse says:

    A PowerShell activity can also be used here:

    Param($acctName)

    $out = [System.Text.RegularExpressions.Regex]::Replace($in,"[^1-9a-zA-Z_]","");

    Return  $out

    Thanks Gabe Volker for suggesting regex here

Skip to main content