To hide 'Retired' CI's under Impacted CI's in Change Record

Amith6
Tera Contributor

Hello,

Currently under the Impacted CI's in change record, while trying to relate or add the CI, the 'Retired' CI's are also selectable. How to make it not selectable?

Operation Status = Retired

I believe we may need to make the changes in the "Add" UI Action?

Condition in the UI Action is 

current.canCreate() && RP.isManyToMany() && parent.active == true && gs.getProperty('com.snc.task.associate_ci').indexOf(parent.getTableName()) > -1

 

And the script is :

function openCmdbCIServiceList(){
var gajax = new GlideAjax("AssociateCIToTask");
gajax.addParam("sysparm_name","getURL");
gajax.addParam("sysparm_id", g_form.getUniqueValue());
gajax.addParam("sysparm_add_to", "task_cmdb_ci_service");

gajax.getXMLAnswer(openServicesList);
}

function openServicesList(url) {
var cmdbciModal = new GlideModal('task_add_affected_cis');
cmdbciModal.setTitle(getMessage("Add Impacted Services/CIs"));
cmdbciModal.setWidth(1200);
cmdbciModal.setAutoFullHeight(true);
cmdbciModal.on('beforeclose', function(){
refreshImpactedServices();
});
ScriptLoader.getScripts('/scripts/incident/glide_modal_accessibility.js', function() {
cmdbciModal.template = glideModalTemplate;
cmdbciModal.renderIframe(url, function(event) {
glideModalKeyDownHandler(event, cmdbciModal.getID());
});
});
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'styles/incident_glide_modal.css';
document.head.appendChild(link);
}

function refreshImpactedServices(){
GlideList2.get(g_form.getTableName() + '.' + g_list.getRelated()).setFilterAndRefresh('');
var modal = window.GlideModal.prototype.get('task_add_affected_cis');
if (modal && modal.message)
g_form.addInfoMessage(modal.message);
}

function resizeIframe(){
var x = g_glideBoxes.cm_add_affected_cis;
x.autoDimension();
x.autoPosition();
x._createIframeShim();
}

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

this article has the details

Apply Filter to ADD Button on Impacted Services/CI RelatedList

I shared solution here as well

Change the condition for Affected CIs and Impacted Services/CIs Related Lists

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

this article has the details

Apply Filter to ADD Button on Impacted Services/CI RelatedList

I shared solution here as well

Change the condition for Affected CIs and Impacted Services/CIs Related Lists

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you so much Ankur. It worked. 🙂