- 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:00 AM
if (typeof window == 'undefined')
serverResolve();
I'm not certain if this will always work. I think it's a safety mechanism in case the browser results in an error.
"typeof" checks how the variable 'window' returns (either: string, integer, object, etc...). And I GUESS that in this case the variable window is actually the return of the iFrame or browser. I haven't taken the time to see how this works indeep and I'm not a client side javascript expert, so I may be wrong.
But normally the actual code to update is defined before. You create a new function and call it with the onclick field (in case you use the UI action a client-sided).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 08:16 AM
Thanks for the info. I still can't get this going... I am thinking, is there a core which does the 'Save' action, which is available by right-click on a UI button? Because if I do this manually it does the trick, however I want to get into the logic of the UI action.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 08:23 AM
Hi Mitzaka,
Please paste your complete script here so that I can try to answer
Thanks
Pradeep Kumar Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 08:29 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 08:49 AM
Hi,
Thanks for pasting your script.
I have replicated the same and it works fine for me.
Please let me know if you have any other questions.
Thanks and Regards
Pradeep Kumar Sharma