Hey John,
I noticed that you used "firstFromArray" on your Data Action to get the first agent.
Unfortunately as far as I remember there is no equivalent to get the last one.
What I usually do when I need something like this is simply getting all the IDs in an array variable, and then getting the last index on Architect (assuming you are trying to execute that Data Action in an Architect flow).
Does that help you in any way?
If it does, just build a Data Action to get all the agent IDs, and then on architect you can check the number of IDs by using Count(your_array_variable).
Then let's say the Count returns 5... You should then access index 4 (since it starts at 0), to get the last one. Which would look like: your_array_variable[4].
------------------------------
Marcello Jabur
------------------------------
Original Message:
Sent: 02-26-2026 03:11
From: John Carlo Labitag
Subject: Custom Data Action to get last user ID in a conversation
Hi,
Does anyone have a working custom data action that fetches the last user ID in a conversation? (eg. when there are multiple agents in an interaction via transfers or other reasons).
Attaching a working version of this that gets the first agent in a conversation, but have tried multiple times and also raised Care case, we could not get a working version that gets the last agent instead.
#DataActions
------------------------------
John Carlo Labitag
Platform Improvement Analyst
------------------------------