Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Help with Code

dvelloriy
Kilo Sage

Hi Team,

we have a checklist on our change task form which is not getting displayed when we use Service Operations workspace.

As a workaround, we have created a client script to display a message everytime ctask form is loaded which has the hyper link for checklist. However when we click on this link it does not work. It works fine, when we press ctrl and then click on link. why is this happening. Please advise.

 This is the code we have:

 

function onLoad() {
    var ga = new GlideAjax('ClientAjaxUtils');
    ga.addParam('sysparm_name', 'hasCList');
    ga.addParam('sysparm_id', g_form.getUniqueValue());
    ga.addParam('sysparm_table', 'change_task');
    ga.getXMLAnswer(function(response) {
        if (response == 'true') {
            g_form.addInfoMessage('To see the Service Checklist, <a href="/nav_to.do?uri=change_task.do?sys_id=' + g_form.getUniqueValue() + '" target="_blank">click here</a>');
        }
    })
1 REPLY 1

Sid_Takali
Kilo Patron

Hi @dvelloriy Try below code

function onLoad() {
    var ga = new GlideAjax('ClientAjaxUtils');
    ga.addParam('sysparm_name', 'hasCList');
    ga.addParam('sysparm_id', g_form.getUniqueValue());
    ga.addParam('sysparm_table', 'change_task');
    ga.getXMLAnswer(function(response) {
        if (response == 'true') {
            var message = 'To see the Service Checklist, <a href="javascript&colon;void(0);" onclick="window.open(\'/nav_to.do?uri=change_task.do?sys_id=' + g_form.getUniqueValue() + '\', \'_blank\');">click here</a>';
            g_form.addInfoMessage(message);
        }
    });
}