- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2016 10:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2016 02:56 AM
Okay perfect,
Here is a screenshot that shows the parameters of the UI action, Please do the same
Do not forget to put the action name, check client to true, and put the function name on Onclick()
HEre is the script :
function reopenIncidentTest(){
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.showFieldMsg('comments','Reason is required when reopening an incident','error');
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'incident_reopen_test'); //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')
serverReject();
function serverReject(){
current.state = 2;
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2016 02:27 AM
Are you working on incident form ? or another form ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2016 02:30 AM
thanks Zic..
I am working on incident form ,,
but its not changing the state
FYI...
i have created a table which is in different Application ... and there only i have created this UI Action on Table 'incident' to change the state but its not working.
..
in last reply to Arnab i have sent my full code...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2016 03:14 AM
Hi Sandeep,
I believe it is because the value of the "State" field in the incident table is "incident_state" and not "state" which you are using in this line :
current.state = '2';
use current.incident_state = 2 ; this will work I am sure. this is also mentioned in the code i have posted for my Reopen Incident button. See the screenshot.
Please let me know if your problem still persists.
Thanks,
Arnab
Please mark Correct/Helpful according to the worthiness of my solution. Happy Working !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2016 03:27 AM
Hi Sandeep,
Did you try my solution of changing the line current.state = '2' ; to current.incident_state = 2 ; ???
Let me know your result on trying this line with my code.
Thanks,
Arnab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2016 03:32 AM
yeah Arnab...
i have tried this also ..but its not changing the state...
after solution Zic gave latest one ...i am able to execute it but its opening new incident instead of changing the state of existing one.