UI action to create child incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2012 12:13 PM
Trying to create something in the UI that will let me create a child incident (one that contains some of the parent's data).
Based on some of the posts I've seen here, I did the following:
var fieldList = 'sysparm_query=active=true^u_inc_type=2';
fieldList += '^parent=' + current.sys_id;
fieldList += '^cmdb_ci=' + current.cmdb_ci;
fieldList += '^u_priority_engserv=' + current.u_priority_engserv;
fieldList += '^u_platform=' + current.u_platform;
fieldList += '^category=' + current.category;
fieldList += '^subcategory=' + current.subcategory;
fieldList += '^u_service_type=' + current.u_service_type;
fieldList += '^caller_id=' + current.caller_id;
redirectURL = 'incident.do?sys_id=-1&' + fieldList;
action.setRedirectURL(redirectURL);
I marked this UI action as being for the Incident table, and as being for the "form context menu".
Two questions:
1. Despite specifying a "parent", the incident that gets created seems never to be linked to the original incident. I observe that the constructed URL has a "parent" value in it, and it looks right, but neither the new incident nor the original are linked to each other in any way, after the new incident is saved.
2. This UI action *still* shows up as a button on the "child incidents" tab, even though I don't want it to. Again, I made the UI action a "form context menu" action (only). How do I get it *not* to appear on the child incidents tab? This matters because, in the child incidents tab, the action's script appears *not* to run in the context of the incident that's on the page... That is, "current" has no values in it, when I get to this UI action from the child incident's tab. It only has values if I select the action from the form context menu.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2012 11:39 AM
Any thoughts on this part:
----------
On the "Child Incidents" tab (which indeed appears to come from the "Incident>Parent" mechanism you mentioned; that was already there, and is the part of the page I was referring to when I mentioned "Child Incidents"), there's a "New" button. As discussed, I can get rid of it by changing the condition to something that evaluates to false (like "false", even). Question is, does that affect anything else? I ask because the associated UI action has its "Table" value set to "Global". That leads me to believe that this "New" button shows up elsewhere, and does context-appropriate things... By hiding it, am I going to break something elsewhere, that I'm not even aware of?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2012 03:22 PM
klassa
I wouldn't touch the UI Action as yes it will show up (or not if you set it to false) in other places. You could add a condition like if current table is incidnet return false, but a much better way is to modify the properties of the related list.
To do this right click on one of the field column headings of the related list (blue bar which has the "cog") and select personalize -> list control.
From there you can set an individual new condition, assign roles to the new button, or just check "omit new button".
~Robert