Recent searches
No recent searches
Hide Empty Fields in my Activities Page
Answered
Posted Jan 06, 2015
I have custom fields and forms and some fields don't appear on certain forms. However, when an end user goes to their ticket, they see all the fields and not just the ones associated with that form. How can I get the Help Center my activities screen to only populate the fields with data? I have this JS logic but have been unable to get it to work. Worse yet, if I modify the theme at all, the "Add reply" button doesn't show up.
$('.request-details dd').each(function() {
var fieldValue = $(this);
if (fieldValue.text() === '-"')
{
fieldValue.prev().remove();
fieldValue.remove();
}
});
Ideas?
0
14
14 comments
Official
Jake Bantz
Hi Everyone!
This is actually achievable with Curlybars now! In the Request Page template, where the field names and values are rendered, we want to add this code to only render fields without blank values:
Here is where I placed the code in my Help Center using the Copenhagen theme - the other themes should have an entry very similar which iterates through the 'custom_fields':
I hope this is helpful!
0
Administrator
For anyone who is interested, support gave me this code instead and it works great.
var fieldValue = $('.request-details dd');
$.each(fieldValue, function(i, val){
var dd_text = $(val).text();
if (dd_text=="-") { $(val).prev().hide(); $(val).hide();
}
});
0
Jennifer Rowe
Thanks for sharing the code, Michelle! Glad you got the help you needed.
0
Guilherme Matos
I try to apply this code of Michelle sharing, but doesn't work for me.
This code apply in JS of Help Center, right ?
0
Antonio Gomes
This was working flawless in my Zendesk till some time ago.
Looks like something changed recently in the HC and it's no longer working.
0
Clarinda Dodson
I'd really like to be able to use this in our instance of zendesk. Where do I implement the code?
0
Jessie Schutz
Hi Clarinda!
You'd put that in the JS section of your Help Center theme. Just proceed with caution if you're not familiar with coding; if your Help Center breaks from any custom code you add, Support might not able to help you fix it!
0
Clarinda Dodson
Thanks, Jessie! It's not working for me. Should I open a ticket for someone in support to help me with the code by looking at my instance?
0
Jessie Schutz
Hey Clarinda!
Our Support team isn't able to help with those types of customizations, I'm afraid. I'll check to see if one of our Help Center gurus here in the Community can give you some guidance!
0
Clarinda Dodson
@Michelle - What template are you using? I'm wondering if this code only works with certain templates.
@Jessie - Any word from your HC gurus?
0
Jessie Schutz
@Clarinda - I've sent up the bat signal for our 'civilian' Moderators, several of whom are really great with custom coding in HC. They jump in as they're able.
Looking a little more closely at the original post, it looks like it's about a year and a half old. I'm wondering if some of the changes we've made to Help Center since then have made it so this JS is basically obsolete...
I'll see what else I can dig up.
0
Clarinda Dodson
Thank you so, so much, Jake! This code worked like a charm. Our users will be so happy. :)
Thanks again.
0
Jessie Schutz
I love it when a plan comes together. :D
0
Julien Van de Casteele
thanks Jake!
0