Reset the Primary Email Address to the original value!

6 댓글

  • Greg Katechis
    Zendesk Developer Advocacy

    Hi Wilhelm! I reviewed your post and I would like to ask some clarifying questions...

    Is the issue that you're trying to solve here that you just don't want to save the original email address to a ticket field? If that's the case, you could potentially save the email address to local storage, but any other suggestions that I have would be pretty hacky and worse than what you're already doing.

    If there is another issue, could you explain in some more detail what is going wrong? Are there any console errors that you can share?

    0
  • Wilhelm Lenz

    Hello Greg,

    but I want to save the email to a ticket field, the code before the "client.on("ticket.submit.done")" works fine too, I have no problems with that. The problem is...

    when I open a ticket as an agent and select the correct requester address in the app to send my message to the correct person, the sub email address becomes the primary email address. So that works. But if I then send the message using the "Submit as New" or "Submit as Open" or similar button in the ticket, then the Primary Email Address should be reset to the original state. Unfortunately this doesn't work and I can't currently understand why. My code after the "submit.done" works elsewhere. Inside the "submit.done" it doesn't seem to be executed though, which I find strange. Some functions or even console outputs seem to be executed, just not what I have implemented there at the moment. But as already said, the code itself works elsewhere outside of the "submit.done".

    0
  • Greg Katechis
    Zendesk Developer Advocacy

    It's difficult to say exactly where this may be going wrong, so I'm wondering if you've stepped through this with a debugger so you can see exactly at what point in the process the code breaks down? If you haven't, could you try that and let us know if you find our where the problem is and can't figure out the solution?

    0
  • Wilhelm Lenz

    Hi Greg, I have run through this with a debbugger. This breaks after I send the ticket as an agent to the requester. However, I want it to reset the Primary Email Address right after sending the message.

    0
  • Wilhelm Lenz

    Is it generally possible in Zendesk to change the Primary Email Address through the Support App (which I already do with my app) and then reset it again after submitting the ticket (which is not working right now)? When changing the primary email address through the app, a secondary email address of the end user becomes the primary email address and the primary email address becomes the secondary email address. What can I do to reset this after the agent sends the message on a ticket? I use the /users endpoint for requests. Should I rather use the endpoint /end_user? And if I should use the /end_user endpoint, do I need to change only this url parameter or also all other parameters?

    Also, I can't save the Primary Email Address to a fixed point when reading to be able to access it again to reset the Primary Email Address, since the Primary Email Address reading is done from the created field. But since I change the primary email address, the field is also updated. Is it possible to lock fields against updates?

    Thanks a lot for your help

    0
  • Wilhelm Lenz

    Hi Greg,

    I have been able to solve my problem in a different way. But now I have another question...

    When I replace the primary email address with a sub email address using "make_primary", it doesn't show up directly in the ticket fields and user data unless I refresh the browser. The same is when I start the reset function to reset the primary email address. The reset function always starts when I open a ticket and it works. Only the display in the UI is not updated directly, only when refreshing the browser. Sometimes the browser has to be refreshed two or three times to see the correct result in the UI.

    The question is:

    Is there a way to see the refresh directly without doing a browser refresh in the code? This is not very user friendly otherwise.

    0

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

Zendesk 제공