Display a custom Description based on the ticket field value

Beantwortet

13 Kommentare

  • Trapta
    Community Moderator

    Hi @Vu Phan,

    It should be -

    if('#request_custom_fields_24239536' == 'No') {
    $('.request_custom_fields_24239536 p').html('This is a custom message.');
    }

    instead of 

    if('#request_custom_fields_24239536' == 'No') $('.request_custom_fields_24239536 p').html('<p>This is a custom message.</p>');

    Cheers,

    Team Diziana

    0
  • Amie B

    Hey Trapta,

    I've been playing around with your code to try and get my own version to work but no luck. 

    I'm just looking for somehting simple here. 

    If request_custom_fields_360026391973 is present on the form, then display this text below. and I want to be able to format the text. I have some formatting set up in a class on the css page for it.

    Any ideas on some example code which might be able to do this for me?

    Best,

    Amie

    0
  • Trapta
    Community Moderator

    Hi Amie B,

    Apologies for the delays in getting back to you on this. You can try below code to accomplish something like this:

    var fieldLen = $('.request_custom_fields_360026391973').length;

    if (fieldLen) {
    $('.request_custom_fields_360026391973 p').addClass('YOUR_CLASS_NAME').html('This is a custom message.');
    }

    Replace 'YOUR_CLASS_NAME' with the name of the custom class you have set up for formatting.

    Let me know if this solves your issue.

    Thanks

    Team Diziana

    0
  • Thanos

    Hey there,

    I have a hard time understanding where I should write this code.

    Can somebody assist with that?

    Thanks

    Thanos

    0
  • Sushant Awalekar
    Community Moderator

    Hi Thanos,

    You can simply add the above code in new_request_page.hbs and that's it!


    Please change the custom field value and make sure you add the code inside the script tag as shown in the sceenshot.




    -sushant


    0
  • Thanos

    After doing that it will only show the description that I wrote in the code and not the original description of the ticket field.

    I want the description from the code part to be only shown when the respective field value is chosen.

    Is something that I'm doing wrong?

    Also can I have an option for every value of a drop box?

    0
  • Sushant Awalekar
    Community Moderator

    Thanos

    Try this

    <script>
    $("#request_custom_fields_360038742212").change(function(){
    $(".custom_txt").remove();
    let dd_val = $('#request_custom_fields_360038742212').val();
    if(dd_val == 'palms_operation') {
    $('.request_custom_fields_360038742212').append('<span class="custom_txt">This is a custom message.</span>');
    }
    });
    </script>
    0
  • Thanos

    That works, but, custom description is being displayed for only one value, I want to have a different description for every value chosen and ideally, I'd like the custom description for every value to replace the original description of the ticket field instead of being displayed under the description.

    Thank you very much for your help so far Sushant Awalekar

    0
  • Thanos

    Any thoughts on this?

     

    0
  • Sushant Awalekar
    Community Moderator

    Thanos

    Yes, this is possible with some modification in the code I posted earlier. you can compare your values in multiple if conditions and display custom descriptions accordingly.



    0
  • Kuldeep Patidar

    Hey everyone!

    I don't believe this question has been asked yet in any of the articles.

    I would like to see the "Locale" filed value to be shown under ticket first description box as a comment. (like shown in the below screenshot). I want to see Locale: it_IT on the right hand side description part.

    Can anyone please help me?

    Kuldeep

    0
  • JJ
    Zendesk Customer Advocate

    Hello Kuldeep Patidar,

    Unfortunately, this cannot be done via triggers.

    We have the locale object in the API, but unfortunately, we do not have it as a condition in the triggers.

    0
  • AirDroid

    Yes, this is possible with some modification in the code I posted earlier. you can compare your values in multiple if conditions and display custom descriptions accordingly.

    @Sushant Awalekar  

    Could you post the code for reference?

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk