locked
SharePoint WorkFlow: Using Full User name instead of domain\userId RRS feed

  • Question

  • Hi

    I have a Assigned to: Field in my list which is off course a People Picker field, I have a SPD workflow which uses that filed to send an email. All Good till this point. The issue starts when i try to write FULL USER NAME inside the email body (From Assigned to: field). It gives me name like "DOMAIN\UserID", Which off course should be changed/converted to FULL USER NAME.

    To start with i thought its gonna be a simple problem but trust me i have looked at every forum and article available on internet/google to find a simple solution for this but i couldn't find any think except

    1. The solution available is to install "useFull SPD activities"  package  which is available on CodePlex (http://spdactivities.codeplex.com/)

    I dont wanna install that on my server

     

    2. The other solution is to create a hidden Column and calculate FIRST_NAME + LAST_NAME (combination getting from UserId,) using Calculated formula column

    I use this one cuz to use this solution the USERNAME must be in FIRSTNAME(.)LASTNAME format which i dont have in my organization.

     

    Please help me out

    Best regards


    SharePoint 2007 (Administration/Development) | Web developer and .NET DTS Programmer | .NET Framework 2.0/3.5 | SQL Server 2008/2005/2k
    Friday, December 30, 2011 6:10 AM

Answers

  • Hi aliusmankhan1,

     

    The best way to resolve the issue is install “useFull SPD activities” on codeplex. But you don’t want install that on your server.

    So, I suggest you to develop  event handler. You can create a column to storage the user display name. Then create an event handler, when an item was created, you can put the user display name in the column. On your workflow, when you want use the display name, please use that column. You can have a try it with event handler. You can refer the following C# code.

     

    public override void ItemAdding(SPItemEventProperties properties)

            {

                base.ItemAdded(properties);

                properties.ListItem["DisplayName"] = properties.UserDisplayName;

                properties.ListItem.Update();

            }

     

    Hope this helps.

     

    Thanks,

    Jack

    • Proposed as answer by Rashu,Rahul Friday, December 30, 2011 8:58 PM
    • Marked as answer by aliusman Tuesday, January 3, 2012 12:46 AM
    Friday, December 30, 2011 10:13 AM
    Moderator

All replies

  • Hi aliusmankhan1,

     

    The best way to resolve the issue is install “useFull SPD activities” on codeplex. But you don’t want install that on your server.

    So, I suggest you to develop  event handler. You can create a column to storage the user display name. Then create an event handler, when an item was created, you can put the user display name in the column. On your workflow, when you want use the display name, please use that column. You can have a try it with event handler. You can refer the following C# code.

     

    public override void ItemAdding(SPItemEventProperties properties)

            {

                base.ItemAdded(properties);

                properties.ListItem["DisplayName"] = properties.UserDisplayName;

                properties.ListItem.Update();

            }

     

    Hope this helps.

     

    Thanks,

    Jack

    • Proposed as answer by Rashu,Rahul Friday, December 30, 2011 8:58 PM
    • Marked as answer by aliusman Tuesday, January 3, 2012 12:46 AM
    Friday, December 30, 2011 10:13 AM
    Moderator
  • Would this be placed in a CEWP?   How can it be modified for list item edits?  Thank you for your help.  I want to have the display name appear in a workflow - verses the domain username.  After a user approves an item, I want to store the display name of the modified by person in a column or a workflow variable so I can send a workflow email and show the approver's display name...  Thank you for your help.
    Tuesday, March 27, 2012 5:08 PM