- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 09:18 AM
Hello I have a UI Action on Incident for resolved state , up on clicking it should get the current time and populate in that resolved field
Below is the code i am using
what am i missing ? every thing is working except resolves at
function resolveIncident(){
//Set the 'Incident state' and 'State' values to 'Resolved', and display mandatory fields
g_form.setValue('incident_state', 6);
g_form.setValue('state', 6);
g_form.setValue('resolved_by', g_user.userID);
g_form.setValue('resolved_at',gs.nowDateTime());
gsftSubmit(null, g_form.getFormElement(), 'resolve_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')
serverResolve();
function serverResolve(){
current.incident_state = IncidentState.RESOLVED;
//current.resolved_at =gs.nowDateTime();
current.update();
current.resolved_by = gs.getUserID();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 09:57 AM
If you are not able to do it, then here is the OOB code. You can replace it
function resolveIncident(){
//Set the 'Incident state' and 'State' values to 'Resolved', and display mandatory fields
g_form.setValue('incident_state', 6);
g_form.setValue('state', 6);
g_form.setValue('resolved_by', g_user.userID);
gsftSubmit(null, g_form.getFormElement(), 'resolve_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')
serverResolve();
function serverResolve(){
current.incident_state = IncidentState.RESOLVED;
current.state = IncidentState.RESOLVED;
current.update();
current.resolved_by = gs.getUserID();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 09:47 AM
Is the page getting refreshed? Try refreshing the page once and see if it is populated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 09:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 09:50 AM
just noticed when i add the mandatory fields and click on the Ui action again , instead of saving its opening the Ui action itself
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 09:53 AM
Can you revert back the OOB changes. The resolved user and resolved by are auto populated by OOB business rule. I was under impression that you were making some custom changes. You dont have to populate these fields, they would come up automatically once you resolve it.
So please revert the changes made to the OOB UI action and it will work as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 09:54 AM
how do i do that ?