Ui action for problem form

Shiva prasad t
Tera Guru

We have a requirement that, we need to add one Ui action to the related list of outages in problem form.

When we clicked on that button, it should open a list view of outages.

Can any one help me with the script.

Any help will be appreciated.

Thank you,

Shiva

 

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So what did you start with and where are you stuck?

Did you check something similar is available on incident or problem and you can try to replicate that?

Regards
Ankur

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

Actually in those scripts, they called script includes i think.

So, i didn't understand what I need to change in those.

Basically i am not good at scripting. so, i didn't tried it. That's why i asked help in scripting.

Hello @Ankur Bawiskar 

With your suggestion i tried by copying the script of Incident and i configured some what i know.

when i tried on clicking on that button, the outages list is opening as expected. But, when i tried to add an outage to the problem by selecting record in it, it is not adding outage record to it.

This is the script which i have configured :

 

function openIncidentList(){
    var gajax = new GlideAjax("BulkAddChangeRequest");
    gajax.addParam("sysparm_name","getURL");
    gajax.addParam("sysparm_sys_id", g_form.getUniqueValue());
    gajax.addParam("sysparm_parent_table", g_form.getTableName());
    gajax.getXMLAnswer(openListModalIncident);
}

function openListModalIncident(url){
    //render the modal
    var incModal = new GlideModal('incident_add_records');
    incModal.setTitle(getMessage("Add Incidents"));
    incModal.setWidth(1200);
    incModal.setAutoFullHeight(true);
    incModal.on('beforeclose', function(){
        refreshRelatedIncidents();
    });
    ScriptLoader.getScripts('/scripts/incident/glide_modal_accessibility.js', function() {
        incModal.template = glideModalTemplate;
        incModal.renderIframe(url, function(event) {
                glideModalKeyDownHandler(event, incModal.getID());
            });
    });

    var link = document.createElement('link');
    link.rel = 'stylesheet';
    link.href = 'styles/incident_glide_modal.css';
    document.head.appendChild(link);
}

function refreshRelatedIncidents() {
    GlideList2.get(g_form.getTableName() + '.' + g_list.getRelated()).setFilterAndRefresh('');
}

Hi,

you will have to understand and the code and debug since you have picked it from some other table

Regards
Ankur

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