Report on reopen reason for incidents

Thereza Van der
Tera Contributor

Hi all

 

Our ServiceDesk need to report on reasons why incidents have been reopened. The reason is saved in the 'additional comments' field, but when I add that to my report, is obviously displays all additional comments. Is there a way to only show the reason for reopening?

 

Thanks

Thereza

 

1 ACCEPTED SOLUTION

Hi @Thereza Van der ,

 

You can create a new field type like string and give some label ,

 

Create a onload client script to hide the field ,

swathisarang98_0-1709629728307.png

 

g_form.setVisible('u_reason_reopen',false);

 

 

In the Ui action you can just add 2 lines of code something like below,

 

 

g_form.setVisible('u_reason_reopen', true);
g_form.setMandatory('u_reason_reopen', true);

 

 

Ui Action Complete code:

 

// Client side onclick function
function reopenIncident() {


    if (g_form.getValue('comments') == '') {
        // Remove any existing field message, set comments mandatory, and show a new field message
        try {
            g_form.hideFieldMsg('comments');
        } catch (e) {}
        g_form.setMandatory('comments', true);
		g_form.setVisible('u_reason_reopen', true);
        g_form.setMandatory('u_reason_reopen', true);
        g_form.showFieldMsg('comments', getMessage('Please enter a comment when reopening an Incident'), 'error');
        return false; // Abort submission
    }
    // Call the UI Action and skip the 'onclick' function
    gsftSubmit(null, g_form.getFormElement(), 'reopen_incident'); // MUST call the 'Action name' set in this UI Action
}

// Code that runs without 'onclick'
// Ensure call to server side function with no browser errors
if (typeof window == 'undefined')
    serverReopen();

function serverReopen() {
    // Set Incident state to active, update and reload the record
    current.incident_state = 2;
    current.state = 2;
    current.update();
    gs.addInfoMessage(gs.getMessage("Incident reopened"));
    action.setRedirectURL(current);
}

 

 

Based on this field create a report

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,

Swathi Sarang

View solution in original post

14 REPLIES 14

@Thereza Van der  great 😀Keep learning 😊

Hi Swathi

 

I used the script on the UI policy (OOB) just as you have it above with those two lines you added and the client script is also exactly as you said in this post.

 

I would appreciate any help.

 

Thanks

Thereza

Hi @Thereza Van der ,

 

Can you share me the screen shot of entire Onload Client script also share ui action screen shot ,

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

Hi Swathi

 

Herewith the screenshots as requested.

Hi @Thereza Van der ,

 

In your onload client script field name given is wrong change it to '

u_reason_reopen

 

Check the same in the ui action its correct but still cross verify .

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang