Question

Photo of Jeremy Turgeon

0

Using Lava to Convert User ID

When running a SQL query on a Workflow, I'm trying to pull up a person's name.  While the query does return the person, it's formatted as their ID and not name (e.g. 7ac48ab4-5544-4f0c-8f4e-33ca01e0bbc0 instead of Bob Jones).  Is there a way to report their actual name, perhaps using Lava?

  • Rock RMS

    Jeremy, would it be possible to share a screenshot of your workflow action and/or SQL query?

  • Photo of David Turner

    0

    If you are trying to get the person's name for the 'RequesterName' attribute and it is a Person field type attribute, the value is the person's PersonAlias guid, so you would have to join to the person table to get the name.  For example...

        ( SELECT TOP 1 p.[NickName] + ' ' + p.[LastName] 
        FROM [AttributeValue] av
            INNER JOIN [Attribute] a on a.[Id] = av.[AttributeId] and a.[Key] = 'RequesterName'
            INNER JOIN [PersonAlias] pa on pa.[Guid] = CAST( av.[Value] AS uniqueidentifier )
            INNER JOIN [Person] p on p.[id] = pa.[PersonId]
        WHERE av.[EntityId] = w.[Id]

  • Photo of Jeremy Turgeon

    0

    SQL Query.PNG

    Comm Req.PNG