Report creation with close note less than or equal to 10 characters

abhi_b
Tera Contributor

Hello everyone,

 

I would like to ask if someone can help in creating a report that has a condition which i'm not able to achieve with out of the box features in servicenow.

 

Ask is to create a report on incident table having records closed in last 3 months and have resolution note (close_notes) less than or equal to 10 characters. Being new to servicenow, I'm easily able to create a report for incidents closed in last 3 months but the other requirement for resolution note (close_notes) "less than or equal to 10 characters", I'm not able to achieve.

 

Can someone help me to achieve this functionality? I would be really appreciating and helping for me as a initial learner.

 

Thanks in advance.

 

Regards,

Abhishek

1 ACCEPTED SOLUTION

Prasanna_Patil
Kilo Sage

Hi @abhi_b 

 

you can use "configure function field", 

Prasannap20_0-1712334541490.png

Steps:

1.Create new "configure function field"

Prasannap20_1-1712334654493.png

2.Once the Function is created save the report

3.Search for the function in the Filter

Prasannap20_2-1712334745509.png

4.Keep the filter as shown above and run the report. Result will be displayed as shown below

Prasannap20_3-1712334831989.png

Kindly mark correct and accept the solution if you find this resolves your query.

 

Thanks and Regards,

PP 

View solution in original post

5 REPLIES 5

Not applicable

Hi @abhi_b ,

For your use case you can get the closed dates but counting the number of characters not possible, what you can get is :

SandeepDutta_0-1712326204196.png

 

 

Maddysunil
Kilo Sage

@abhi_b 

I think you can write the script include to fetch the sysids of required incidents and call the script include in report filter condition like SysId isoneof  javascript: new scriptIncludeName().getFilteredIncidents();

below is the sample script include you can use:

 

 getFilteredIncidents: function() {
        var incidentGr = new GlideRecord('incident');
        incidentGr.addQuery('closed_at', '>=', gs.beginningOfLast3Months());
        incidentGr.addQuery('close_notes', '!=', ''); // Exclude incidents with empty close notes
        incidentGr.query();

        var filteredIncidentsSysIds = [];
        while (incidentGr.next()) {
            var closeNotes = incidentGr.getValue('close_notes');
            if (closeNotes.length <= 10) {
                filteredIncidentsSysIds.push(incidentGr.getUniqueValue()); // Push sys_id of the incident
            }
        }
        return filteredIncidentsSysIds;

 

Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

Prasanna_Patil
Kilo Sage

Hi @abhi_b 

 

you can use "configure function field", 

Prasannap20_0-1712334541490.png

Steps:

1.Create new "configure function field"

Prasannap20_1-1712334654493.png

2.Once the Function is created save the report

3.Search for the function in the Filter

Prasannap20_2-1712334745509.png

4.Keep the filter as shown above and run the report. Result will be displayed as shown below

Prasannap20_3-1712334831989.png

Kindly mark correct and accept the solution if you find this resolves your query.

 

Thanks and Regards,

PP 

Thank you so much @Prasanna_Patil for this solution without much going to scripting part. This has helped me to create the required report which was asked to me.