Getting Email from Person Attribute

Good afternoon, 

I know at least one other person has asked about this (Question link here), and similar to that person, I believe I've gotten fairly close to retrieving an email address from a custom attribute, but I'm a bit stuck at this point.

We have a form with a custom person-selector field (called RequestorManager) where a Requestor can enter their manager's name from TDX's list of employees in our environment. I'd like to have a workflow step pull that manager's email address, and then use that email in a later workflow step to post a comment to a ticket where the manager's email address (along with the Requestor's email) is a comment notification recipient. I've created the following items:

  • A web service call to GET the ticket ID and the RequestorManager
    • I call this in a workflow step, and save the results as "Response" in the Response Body area of the workflow step. 
      This part works fine, though I will mention that I don't see a UID in the RequestorManager details within the body of "Response" (so maybe that's what I'm missing).
  • I have a second web service call to POST with the following parameters:
    • TicketID > String > From Ticket > ID
    • ManagerEmail > String > From Workflow > Response.Attribute[?(@.TicketID==2582)].Value
      I used the "Response.Attribute[?(@.TicketID==2582)].Value" based on the info provided to the question I referenced earlier, though I may have misunderstood what the advice in that other question was saying. The "2582" is the attribute ID of my custom attribute.
    • The body is an attempt at a comment output
      {"Comments":"{{ManagerEmail}}"}
    • I call this web service in another workflow step, but it fails as a bad request.

Any pointers are appreciated, and if you anyone needs more specific info to help troubleshoot, please let me know.

Thank you.

Nate

Asked by Nate Sakovitch on Tue 10/24/23 1:13 PM
Sign In to leave feedback or contribute an answer

Answer (1)

This answer has been marked as the accepted answer
Mark Sayers Tue 10/24/23 2:07 PM

Hi Nate,

If you're trying to get at the email address of a person selected on a custom person attribute on a ticket's form, you'll want to GET the ticket first (which you seem to be doing), then use that attribute's value (because it'll be the UID of the selected person) to then GET that person's TDX record as your second call. A third call would then reference the response of the 2nd call to PATCH the original ticket with the appropriate email field value from the person object that was obtained in call 2.

In your Parameter you mention where you're doing ManagerEmail > String > From Workflow > Response.Attribute[?(@.TicketID==2582)].Value I think that is being referenced incorrectly. It would be referenced like so:

Response.Attributes[?(@.ID==2582)].Value

assuming "Response" is what you named the correct response body of the preceding web method. Keep in mind you want to keep named web method responses unique so you can refer to the correct response body if needed later in the workflow.

Sincerely,
Mark Sayers
Sr Support Consultant, CS

No feedback
Hi Mark,

Thanks for the info.

I decided to go another route and just use a workflow Notification step to send the message to the manager in the custom attribute. Afterwards, I used another workflow step for an API call that adds a comment in the ticket's feed that's a copy/paste of the previous workflow notification.

A bit cumbersome for the workflow, but it's just one API to post the comment rather than the multiple. I might revisit later, and I noticed that the other question similar to mine came up with a single API approach, so that's something I'll see if I can recreate down the road.

I think we can close this out for now, and if/when I revisit, I'll open a new ticket.

Thanks for looking into this either way.

Nate
- Nate Sakovitch Thu 11/9/23 1:51 PM