Pages

Tuesday, July 2, 2013

Nintex: Replace part of a string


Nintex Workflow Objective:
Strip off the extra characters and the domain name from the results of a people picker (in a SharePoint list) to get just the user ID in order to query LDAP for another part of my workflow.

Note: SharePoint 2013 adds a set of characters to the beginning of a user ID when you display the ID:

i:0#.w|domain\criesberg

The good news is that these are not random characters.   We just need to remove them with a Nintex function.

NOTE: There is a great article about what these characters mean:
http://social.technet.microsoft.com/wiki/contents/articles/13921.sharepoint-2013-and-sharepoint-2010-claims-encoding.aspx (They basically describe the type of claim and where it comes from.)

Solution:  
Choose the Build String (Insert -> Operations -> Build String) and use the fn-replace to strip off the extra characters.  The function looks like this:


fn-Replace({ItemProperty:_x0067_wh5},i:0#.w|domain\,)
  • Item property is the reference to a column in the SharePoint list.  It is a people picker from the list.
  • A comma.  Then the text you would like to have replaced.  (This is case sensitive.) 
  • Then, another comma.  After this second comma, write the text you would like to appear instead of the replaced text.  In my case, this is nothing, so I close the expression.
  • Store the result in a text variable you have created. My variable is named userID.
It looks like this in Nintex:


No comments:

Post a Comment