Zendesk - How to detect if I Change (before submit) Requester Name in opnened Tickets.

답변함

5 댓글

  • Tipene Hughes
    Zendesk Developer Advocacy

    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

     

    0
  • richestsoft dev

    Thank you for you response.
    This is not working for me when I change requester name.

    0
  • richestsoft dev

    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 onLoad

    in the html section

    <p>{requesterName}</p>
    0
  • richestsoft dev

    Update

     

    the following worked for me.

    if (client) {
        client.on('ticket.requester.name.changed', function(e) {
            console.log("name is :", e)
    }); }

     

    0
  • Tipene Hughes
    Zendesk Developer Advocacy

    Hey richestsoft dev,

    Thanks for the update - I'm glad you've got it working!

    Have a great day :)

    Tipene

    0

댓글을 남기려면 로그인하세요.

Zendesk 제공