
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2017 04:15 AM
This is something I've been looking into for a while but can't find any info about it.
In our cmdb_ci table I have added a filed called CIID (numeric +1 counter for every CI that is created). I added this filed in the top level class so that I can have a CIID for all the children classes of cmdb_ci. What I'm now looking for is a way to have this filed on all the classifications in Configuration > CI Class Manager under Configuration Item.
I was hoping for a way to have this UI filed in all child classifications automatically (inherited) since the CIID filed is found in the cmdb_ci table but I haven't found out how to to so yet...
Is there a way for this or do I have to add this filed manually to all UI classifications forms under Configuration Item?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2017 05:23 AM
Hi Henrik,
The short answer is 'no', the field is not automatically applied to the form. While technically, we COULD add a field to a form, this may not be what you want as it would rarely ever be in the right location (and on all views!) Having done that automatically would still require you to go and modify the form with Configure Form Layout or Configure Form Design.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2018 05:34 AM
Hello Everyone I have found the solution using Script Please mark as helpful and hit like
--------------------------------------------------Adding field to formlayout of all child tables using script-------------------------------------------------------------
var tu = new TableUtils("u_test"); //base table name
var classes = tu.getHierarchy();
gs.include("j2js");
var jsClasses = j2js(classes); //get all child table as well as base table
var arr=[];
var gr= new GlideRecord('sys_ui_section');
gr.addQuery('name', 'IN', jsClasses);
gr.addEncodedQuery('view=Default view^captionISEMPTY');
gr.query();
while(gr.next()){
arr.push(gr.getValue('sys_id')); //push the sys_id of the ui section with empty caption
}
for (i=0; i < arr.length; i++){
var gr1= new GlideRecord('sys_ui_element');
gr1.initialize();
gr1.sys_ui_section=arr[i];
gr1.position=-1; //position of the field on form
gr1.element='u_final'; //field to be added on all form layout
gr1.insert();
}
----------------------------------------------------------------------------------------------------------------------------------------------------

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2018 08:31 AM
Don't forget to use var i = 0 in your for loops. If you forget to, you could be using a global variable from some other scope and cause unpredictable results in your loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2018 10:49 PM
In my search for the answer to the same question I decided to create a solution myself.
If any one is still looking for a simple solution to this problem please see the attached fix script.
https://github.com/aidanwardman/ServiceNow-Scripts/blob/master/CMDB/CMDB-Add-Existing-Elements-To-All-Children.txt
"Elements" variable is a list of "Pre-existing" field names from the base CMDB_CI class that you wish to have displayed on all children CI's.
I also have another script that does the creation of an element on the base class, but it is just as easy to create an element on the base class, get the column name, then use the script above.
Cheers,