- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2014 06:35 AM
Hi SNC,
I am struggling to get an UI Action to set a value on my record (incident) and update/save the form, but I cannot manage to make it work.
I am using a UI acton other than 'Update', it's a separate button and I would like it to do a certain thing and then perform what the Update' button does.
So My script ends up with: (please see attached).But I can't make the incident update.
Please give me some thoughts on this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2014 02:47 AM
Mark the field u_status as not read-only, and then you check when you click the button, if there are double or wrong entries.
also re-verify all the settings of the UI action:
Name: Go Back In Progress
Table: incident
Order: 100
Action Name: goback_in_progress
Client: checked
Form button: checked
Onclick: gobackinprogress();
especially the onclick field needs to match the function in the script
Condition:
(current.state != 7 && current.u_status != 'Resolved' && current.u_status != 'Manager review' && current.u_status != 'Problem review' && current.u_status == 'Restored pending verification') && (gs.hasRole("itil") || gs.hasRole("itil_admin") || current.caller_id == gs.getUserID())
What may be possible here is that the script is not executed because of "current.u_status == 'Restored pending verification'"
This line tells the UI action only to be valid when the u_status IS ''Restored pending verification". But in your screenshot it's already 'In progress'.
Also in your script you try to update 'current.stage', but there is no stage field on the incident table. Also if there would be a stage field, you would call it like this:
g_form.setValue('stage', 'In progress');
So I guess you can remove that line
Are you sure that the values and the labels of your choices in 'u_status' are really exactly the same? Calling the values by Script, you need to be careful, they are case-sensitive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2014 08:59 AM
hmmm, first of all, in your function you change the u_status to 'in progress'.
g_form.setValue('u_status', 'In progress');
but then in the serverResolve, as failback you set it to 'restored pending verification'
also you set the state of the current record here to '2', an action that you don't apply with your function
function serverResolve(){
current.incident_state = 2;
current.u_status = 'Restored pending verification';
current.update();
action.setRedirectURL(current);
}
then you set the stage with 'current.stage'. in the client script with setValue you don't need to call 'current'.
g_form.SetValue('current.stage','in progress'); // starts the SLA
BUT wait... the Incident table has no 'stage' field, so I'm really confused here... Are you sure you're pointing to the right field? Or if you created a manual field on the incident table called 'stage', then it would be called 'u_stage'?
Can you please post a screenshot of the form where you try to apply this UI action and then explain exactly what fields you are trying to affect and where you're struggling?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2014 02:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2014 02:47 AM
Mark the field u_status as not read-only, and then you check when you click the button, if there are double or wrong entries.
also re-verify all the settings of the UI action:
Name: Go Back In Progress
Table: incident
Order: 100
Action Name: goback_in_progress
Client: checked
Form button: checked
Onclick: gobackinprogress();
especially the onclick field needs to match the function in the script
Condition:
(current.state != 7 && current.u_status != 'Resolved' && current.u_status != 'Manager review' && current.u_status != 'Problem review' && current.u_status == 'Restored pending verification') && (gs.hasRole("itil") || gs.hasRole("itil_admin") || current.caller_id == gs.getUserID())
What may be possible here is that the script is not executed because of "current.u_status == 'Restored pending verification'"
This line tells the UI action only to be valid when the u_status IS ''Restored pending verification". But in your screenshot it's already 'In progress'.
Also in your script you try to update 'current.stage', but there is no stage field on the incident table. Also if there would be a stage field, you would call it like this:
g_form.setValue('stage', 'In progress');
So I guess you can remove that line
Are you sure that the values and the labels of your choices in 'u_status' are really exactly the same? Calling the values by Script, you need to be careful, they are case-sensitive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2014 04:30 AM
Conmic, thanks a lot for this reply - it was prompt and exactly what I needed.
In the end, here is what was the problem - the g_form.setValue(current.stage....). I just removed that line from the script and it works like a charm now.
Thanks again for analyzing this with me!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2018 05:09 AM
Hi Pradeep,
I have a requirement to design a UI action Button on the problem table and when I click that button all the incidents related to that problem should display on problem work note.
please help me on this
Thanks
Jits