Zendesk - How to detect if I Change (before submit) Requester Name in opnened Tickets.
답변함Hi everyone,
I have a server side app, which display customer info such as name, id, email etc based on currently opened ticket.
My next task is to update the Requester name in Zendesk App ( server side app ) if i made changes in Ticket Requester before submit.
is that possible?
-
Hey richestsoft dev!
Changes you make to the requester of a ticket will be available to the ticket.requester object immediately, even before you hit submit. This means that you'll be able to access the new requester data in your app and manipulate as needed be prior to the ticket being saved e.g:
const getRequester = async () => {
const requester = await client.get("ticket.requester");
const requesterName = requester['ticket.requester'].name;
console.log(requesterName);
};I hope this helps! Feel free to reach out with any questions.
Tipene
-
Thank you for you response.
This is not working for me when I change requester name. -
I am sharing my script what i am trying to do.
Its a server side app developed in nextJs
const [requesterName, setRequesterName] = useState(null);
const getRequester = async (client) => {
const requester = await client.get("ticket.requester");
const _requesterName = requester['ticket.requester'].name;
console.log(_requesterName);
setRequesterName(_requesterName)
};var client = ZAFClient.init();
getRequester(client);the function getRequester(client) is getting called onLoadin the html section
<p>{requesterName}</p>
-
Update
the following worked for me.
if (client) { client.on('ticket.requester.name.changed', function(e) { console.log("name is :", e)
}); } -
Hey richestsoft dev,
Thanks for the update - I'm glad you've got it working!
Have a great day :)
Tipene
댓글을 남기려면 로그인하세요.
5 댓글