Work Notes mandatory when problem goes to closed state when we click re- analyze UI action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 02:24 AM
When we click on re-analyze UI action, when problem goes to closed state, work notes should be mandatory.
- Labels:
-
Problem Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 02:33 AM
Hello pooja,
You need to do a couple of changes in the UI Action:
- mark the checkbox "client"
- on the onclick, insert "reanalize();"
- replace the script by this one:
function reanalize(){
g_form.setMandatory("work_notes", true);
if(g_form.getValue("work_notes") != "")
gsftSubmit(null, g_form.getFormElement(), 're_analyze'); //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') {
action.setRedirectURL(current);
new ProblemStateUtils().onReAnalyze(current);
}
Then your UI Action should be similar to this:
Just for you to understand:
- when the ui action is pressed, the onclick will execute the code that is there, in this case it will execute the function "reanalize".
- The function sets the work_notes as mandatory and if the work notes are populated it will trigger the code that will run outside of the onclick function. That is the code that was there before!
Let me know if this works for you!
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Best Regards,
Filipe Cruz

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 02:40 AM
Hi Pooja,
Try this make sure you check 'Client' as checked and add 'reanalyze()' in Onclick field. Mark my answer as correct if that helps.
function reanalyzeproblem(){
if (g_form.getValue('work_notes') == '') {
// Remove any existing field message, set work notes mandatory, and show a new field message
try {
g_form.hideFieldMsg('work_notes');
} catch(e) {}
g_form.setMandatory('work_notes', true);
g_form.showFieldMsg('work_notes', getMessage('Please enter a work_notes'), 'error');
return false; // Abort submission
}
// Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 're_analyze'); // 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() {
action.setRedirectURL(current);
new ProblemStateUtils().onReAnalyze(current);
}
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2022 05:39 AM
hello Rasheed,
we don't want to touch OOB functionality.
is there any other option to make worknotes mandetory when problem goes to close state.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2022 07:45 AM
Hi Pooja,
Then simply write onsubmit client script like below. Don't forgot to mark my as correct
function onSubmit()
{
var r = g_form.getValue('work_notes');
var er = g_form.getValue('state');
if(r == '' && er == 'closed')
{
g_form.setMandatory('work_notes', true);
return false;
}
}
Regards,
Musab