How can I report on the character count on either description or closure code

Graham Cameron
Tera Contributor

For data quality, I have been asked to run a report where either the description or close notes have a character/word count that is under an acceptable amount.

For example if an agent closed a ticket and in the close notes just put either 'resolved' or 'fixed it'. Then it would be under 20 characters or 10 words.

I need to find a way where I can report all tickets where close notes are less than 20 characters or less than 10 words.

Is this possible or will this require development?

I have looked at the close notes filter and there is a greater than or less than option but I don't know what the measure is there. I have also looked under the related list conditions and I couldn't find anything there either.

Has anyone got a solution for this?

 

6 REPLIES 6

Andrew Finlay
Tera Contributor

Hi Graham,

 

Do you ever get a solution to this? We're looking to do something similar

Hi! 

I managed to do this using Suseela Peddise's approach. I created a script include with the following function:

    getRecordsFromCharacterCount: function(table, fieldName, numberOfCharacters) {
        var res = [];
        var gr = new GlideRecord(table);
        gr.addEncodedQuery(fieldName + "!=NULL");
        gr.query();
        while (gr.next()) {
            var len = gr.getValue(fieldName).toString().length;
            if (len < numberOfCharacters) {
                res.push(gr.sys_id.toString());
            }

        }
        return res.join(',');
    },

 

Then I created a report where I used the filter:

MarenR_0-1742287198938.png

 

This worked, but it is important that the script include has "Accessible from" set to "All application scopes" (if you are working in a scoped application) and that "Sandbox enabled" is checked. A simple way to test it is to add the filter to a list view and see if you get any records.