- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 07:11 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 01:15 AM
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 ,
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 07:46 AM
Hi @Thereza Van der ,
Based on Additional comment or worknote this is not possible, you can create a new field to capture the reason for reopening the incident and report on that field.
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 11:55 PM
Morning Swathi 🙂
Thanks for the reply. I was thinking about a separate field, but was not sure how to get it to use that field instead of the additional comments field. Can I just copy the script and create another UI Action, and replace the 'comments' with the new field name?
I do not know scripting but logic tells me if it works as is, I can just replace the field name?
This is the script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 01:15 AM
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 ,
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 03:40 AM
Perfect ... Perfect ... Perfect!!!
THANKS FOR ASSISTING ME, MUCH APPRECIATED! I learnt a lot from you today.
Regards
t