- 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 06:54 AM
Hi,
The function you have written has no error. I tried making UI action using your function on demo016,It works perfectly.
Just Check if the 'IF' condition is getting satisfied. Try adding Log statements.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 07:33 AM
The only IF I have is this:
if (typeof window == 'undefined')
serverResolve();
This is strange, because I have an identical UI action button with the same ending and it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 06:59 AM
current.u_status = 'In progress';
I guess that your field 'u_status' is a dropdown box or something where you can select between different values?
Note that you need to set the choice in u_status according to the values assigned to its choices and not by the choice-labels.
If this is not it, then I need much more information about what you're trying to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 07:34 AM
Yes, 'In progress' is actually the value of this field.
The thing is, it correctly applies that value on the form. I can see that. But it does not execute the update /save acton, this is my pain.