Recent searches
No recent searches
Listening to 'ticket.collaborators.changed'
Posted Jun 17, 2022
Hello
I've issue I have created an app using ZCLI, and I listening to 'ticket.collaborators.changed' and what I notice is Organization array is empty every time even time a collaborator is added, I just want to know if this known issue or will not return the organization in the array.
0
10
10 comments
Greg Katechis
Hi Michael! `ticket.collaborators.changed` is an event listener and doesn't itself return any data. I'm guessing that there is some action that you're taking during that event that you're expecting will return a user object with that org info in it. Could you share that code snippet with us so that we can see what might be going on here?
0
Michael Thomas
0
Michael Thomas
0
Greg Katechis
ticket.collaborators.changed
fires, what are you doing with it?0
Greg Katechis
Oh, apologies...it looks like your initial code snippet was caught in our spam filter for some reason and I just saw that. I'll get it out of there and then take a look. Sorry for what was probably a confusing response!
0
Greg Katechis
So I've looked over this, but I'm still not entirely sure what you're doing with the event listener here. I'm also not seeing where you're returning any ZAF methods, rather it looks like you are building your own array of organizations while iterating over collaborators that are being passed in to this function by hitting the organization_members endpoint. This appears to be a ticket sidebar app, so you do have access to the user object for collaborators there with this method...could you use that instead?
0
Michael Thomas
Hi Greg,
Reason why I want to listen to the event listener, is I want to warn the user before they save the ticket, that they're about to send a message to someone who is not in the requestors organization. So using the method instead will be after the fact which is to late.
Here is my github path for project https://github.com/mthomas-github/zd_cc_app
0
Greg Katechis
The
return true;
is likely unnecessary as a resolved promise will allow the save to proceed, just adding it to be verbose.0
Michael Thomas
Thanks for the code, but this will not work in my case, as I want to warn them before the submit, so as they add new CC I want do my check, so that why i was listening to the
ticket.collaborators.changed, I might know the reason why organization array is empty, I just have to do a few test.
0
Greg Katechis
0