- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 10:28 AM
Hello friends,
Where can I find the UI action (I assumed it must be an UI action) corresponding to 'Add all' button on Configuration Item sys pop-up which was launched by clicking the 'Add' button on Affected CIs related list on a Change Request. It is basically to choose and add the CIs to a Change Request. Provided a screenshot of it below.
Thanks,
Hari
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2016 05:48 PM
Your Add button on change_request is this UI Action https://<instance_name>.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=77688cfe6f35f100e5f2b3312e3ee4e6
Which refers to the Script Include you were talking about (AssociateCIToTask) and calls the function getURL(). This function returns a UI Page URL containing the right parameters to render the list and its UI Action. The UI Page is task_add_affected_cis.do which is a page that you can't edit or see source code in SNOW. This page is used to create a GlideOverlay (the window that opens).
So the Add All button itself is contained in this page and not editable.
Depending on what you want to do, I found using my developer console, the client script being called by the add all button:
function addAllToTask() {
var g_list = GlideList2.get(NOW.task_add_affected.TABLE_NAME);
var gajax = new GlideAjax("AssociateCIToTask");
gajax.addParam("sysparm_name","addAll");
gajax.addParam("sysparm_id", NOW.task_add_affected.TASK_ID);
gajax.addParam("sysparm_query", g_list.getQuery());
gajax.addParam("sysparm_tableName", g_list.tableName);
gajax.addParam("sysparm_add_to_table", NOW.task_add_affected.ADD_TO_TABLE);
gajax.getXMLAnswer(closeWindow);
}
Depending on your goal you could try to work out the addAll function in the script include to be able to use it based on what you want to do. This would be if you would like to use it somewhere else.
If you want to change the behavior of the Add all button, you could try to rebuild the UI page to have a custom one with your custom button. Or you could modify what the addAll function does inside the Script Include by customizing it (you can't extend it or copy it as the call to the function is hard coded in the UI page you can't modify).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2017 10:55 AM
Hi Mahes,
This one is a little bit cleaner to do thant previous request as it does not require DOM manipulation.
You can edit the "AssociateCIToTask" Script include.
I'm pasting the full new Script Include but here are the modifications:
- New attribute DEFAULT_FILTER in which you can set the default filter that you want
- removeUserFilter is modified to set the default filter instead of clearing the client data for the filter
Depending on how you like to administer your platform, you could create a system property where you get the default filter from so you don't have to modify code if you want to change it.
var AssociateCIToTask = Class.create();
AssociateCIToTask.prototype = Object.extendsObject(AbstractAjaxProcessor, {
SESSION_KEY: 'com.snc.change_request.AssociateCIToTask.ci_user_filter',
DEFAULT_FILTER: 'operational_status=1',
...
removeUserFilter: function(){
//gs.getSession().clearClientData(this.SESSION_KEY);
//Setting the default filter instead of clearing the client data
gs.getSession().putClientData(this.SESSION_KEY, this.DEFAULT_FILTER);
return;
} ,
...
type: "AssociateCIToTask"
});
EDIT: Full code was a bit too much so I did omit unmodified parts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 12:50 AM
Currently I am generating the filter of associate_ci view, through additional sysparm_query attribute in _getURL function of the script include AssociateCIToTask. I need this view filter breadcrumb to be read only.
I can't omit filters from cmdb_ci, as this will remove user capability to search for specific CI.
Is there anyway we can make filter breadcrumb read-only, so that change users can't make any edit with the same?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2021 10:57 PM
Hi Laurent,
Is it possible to add this button 'Add All' to a reference field when it opens? Basically On the Incident form, we have a reference field pointing to 'cmdb_ci'. I'm trying to return all the CI's if a particular is not found using this 'Add All' button. Is it possible to show here?
Thanks,
Ruturaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2020 04:18 AM
Hi Laurent Chicoine,
Is there a way we can remove Configuration class from the ui page or make it readonly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2021 01:09 AM
Updated the above code to remove 'Configuration class' from the UI page.
Mark this reply as helpful if it gives the desired answer.
function openCmdbCIList(){
var gajax = new GlideAjax("AssociateCIToTask");
gajax.addParam("sysparm_name","getURL");
gajax.addParam("sysparm_id", g_form.getUniqueValue());
gajax.addParam("sysparm_add_to", "task_ci");
gajax.getXMLAnswer(openList);
}
function openList(answer){
var url = answer;
var cmdbciOverlay = new GlideOverlay({
id : "cm_add_affected_cis",
title : getMessage("Add Affected Configuration Items"),
iframe : url,
closeOnEscape : true,
showClose : true,
onAfterClose: refreshAffectedCIs,
onAfterLoad: resizeIframe, //Once PRB632264 is fixed by platform we can comment this line
height : "90%",
width : "90%"
});
cmdbciOverlay.center();
cmdbciOverlay.render();
cmdbciOverlay.setOnAfterLoad(replaceAddAllFunction); //Setting the On after load again replace the original one set previously
}
function refreshAffectedCIs() {
var listId = g_form.getTableName() + ".task_ci.task";
var list = typeof GlideList2 !== "undefined" ? GlideList2.getByName(listId) : null;
if (list == null)
list = typeof GlideList !== "undefined" ? GlideList.get(listId) : null;
if (list != null)
list.refresh();
}
function resizeIframe(){
var x = g_glideBoxes.cm_add_affected_cis;
x.autoDimension();
x.autoPosition();
x._createIframeShim();
}
function replaceAddAllFunction(){
//Kepping what the resizeIframe was doing
var x = g_glideBoxes.cm_add_affected_cis;
x.autoDimension();
x.autoPosition();
x._createIframeShim();
var iframe = document.getElementsByClassName("gb_iframe")[0]; //Get the iframe rendered
var addConfigClass = $j(iframe).contents().find("h1.navbar-title"); //Find the 'Configuration Class' Label
var addConfigItem = $j(iframe).contents().find("span.col-sm-3"); //Find 'Configuration Item' selection field
var addAll = $j(iframe).contents().find("#add_all"); //Find the Add All UI action button
$j(addConfigClass).remove(); //Remove the 'Configuration Class' Label
$j(addConfigItem).remove(); //Remove the Configuration Item' selection field
$j(addAll).remove(); //Remove the Add All button
}