- 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-05-2024 03:46 AM
@Thereza Van der great 😀Keep learning 😊
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 05:11 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 05:31 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 06:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 06:41 AM
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