Client.set('comment.text') method does not work

Completed

14 Comments

  • Eric Nelson
    Zendesk Developer Advocacy

    Hey Ryan,

    It's doubtful that your one environment is running an older version of the client. Though you could confirm this by inspecting the app with the developer tools and checking which version of the sdk you're using and compare it to one of your environments that are working.

    Other than that, are there any other differences in this environment (Browser, Zendesk features, etc)? 

    Thanks,

    Eric

    0
  • RyanMichael Hirst

    Yeah we have the same src in our script tag

    <script src="https://assets.zendesk.com/apps/sdk/2.0/zaf_sdk.js"></script>

     

    Does that method work for you at all? Because it does not work on our staging environment now either, or in the v2 REPL App Integration with Zendesk Support app

     
    0
  • Eric Nelson
    Zendesk Developer Advocacy

    Hey Ryan,

    It's tough to say without knowing what 'window' is doing. I'm assuming you're hooking into the window module, but what part are you using? If you're trying to have the client.set triggered on load or some event, a more effective way to do it would be:

    function setComment(){
    client.set({
    'ticket.comment.appendText': ['Wow this is some cool text!']
    })
    }

    window.onload = setComment;
     

    0
  • R Kasai

    Hey Eric,

    I'm in the same situation.
    It was working fine until July 7, but since July 8, I've been getting errors.

    The script here does not work.

        $(document).on('click' ,'#button_clear', function(){
    client.set('comment.text', '');
    client.invoke('app.close');
    });

    ♯Chrome


    0
  • Eric Nelson
    Zendesk Developer Advocacy

    Hey 笠井 玲奈,

    I built a small test app to try and replicate your issue and I was not able to replicate your issue. Seeing that you and Ryan are both experiencing similar issues, I'm going to want to delve a bit deeper into this. 

    Can you let me know a few more details:

    Are you able to replicate on different browsers / incognito? If not, what version of Chrome are you using? 

    When you write a comment are you able to find it in the dom tree when searching the elements from the dev tools?

    Is there a difference in error when clicking the 'clear' button when a comment is present and when the comment body is empty?


    0
  • RyanMichael Hirst

    1. I can replicate on firefox and Chrome. 

    2. The comment exists in the dom node on dev tools under the "zendesk-editor--rich-text-comment" div.

    3. I don't see a clear button under the "Internal Note" section on the ticket view page. Where is that?

     

    I am pretty sure there is a bug with the comment.text setter. All the other client setters / functions work for me.

    0
  • RyanMichael Hirst

    Hey Jeff so I just verified that this method works within the context I am getting the error from

    window.client.set('ticket.assignee', { groupId: xxx, userId: xxx });

    I am trying to call

    window.client.set('comment.text'. '');

    from an app that is in the ticket_editor location. That's where the method should work right?

    0
  • R Kasai

    Hey Eric,

    1. I can replicate on firefox and Chrome. 
    firefox Ver.89.0.2
    Chrome Ver.91.0.4472.124


    2.The comment I wrote exists in the dev tool.

    3.No difference.
    A comment is Null   : TypeError: "comment.text" n.firstChild is null
    A comment is present :  TypeError: "comment.text" n.firstChild is null

     

    0
  • Eric Nelson
    Zendesk Developer Advocacy

    Thank you both! I was able to track down the issue and have submitted the bug request for patching to our dev team. I'll update this thread once we've gotten it all sorted on our end!

    Have a wonderful day!

    Eric Nelson | Manager - Developer Advocacy

    0
  • Eric Nelson
    Zendesk Developer Advocacy

    Hey there,

    Just got word that this bug has been fixed. I've tested and confirmed that both of you shouldn't experience this issue going forward. Thanks again for working with me to track it down!

    Eric

    0
  • RyanMichael Hirst

    Sweet! Thanks a lot Eric really appreciate it

    0
  • Tuomas Savonius

    I have this exact same problem currently, noticed this when switching to new agent workspace layout. However, I can't see the text even in the dev tool.

    0
  • Greg Katechis
    Zendesk Developer Advocacy

    Hi Tuomas! This issue in Agent Workspace is a known limitation at this time. The product and engineering teams are aware of this and do have a resolution for this on their roadmap, although I do not have an ETA to share at this time. 

    0
  • Tuomas Savonius

    My app is not running in the ticket editor tab, it is in the new ticket sidebar.
    There is no documentation in:

    https://developer.zendesk.com/api-reference/apps/apps-support-api/ticket_sidebar/#comment-object

    that I can find explaining that this is feature is missing from New agent workspace, on the contrary it says:

    "In the Zendesk Agent Workspace, setting comment.text during a chat conversation auto-transpiles rich text into plain text (Markdown syntax) in the chat editor."

    Have I understood something incorrectly?

    0

Please sign in to leave a comment.

Powered by Zendesk