Confirmation box not working for workspace UI action

Supriya13
Giga Expert

I have create a UI action "Create problem"

1. I am display confirmation box to create problem

2. If confirmed the create problem script call and show link

3. Display link - problem number , another link existing problem record list 

 

1.Issue - after confirmation -noting is workind

2. Issue - link - to display all the relevant CI problem not display

Code:

Workspace Client Script:

function onClick(g_form) {
    
    var myCI = g_form.getValue("cmdb_ci");
    var ga = new GlideAjax('global.GetCIRecord');
    ga.addParam('sysparm_name', 'CICount');
    ga.addParam('sysparm_ci_name', myCI);
    ga.getXML(HelloWorldParse);

    function HelloWorldParse(response) {
        var answer = response.responseXML.documentElement.getAttribute("answer");
        

        if (answer == 'yes') {

          
            var urlString = '<a class="web" target="_blank" href="' + "/problem_list.do?sysparm_query=active%3Dtrue%5Ecmdb_ci=" + myCI + '">' + "Please click here to view the list" + '</a>';
           
            var userAns = confirm("There is already problem record available for the selected CI.Do you want to create problem?");

            if (userAns == true) {
                count = true;

            } else {
                return false;
            }

        }
           g_form.submit(g_form.getActionName());
    }
}

 

server script :

if (typeof window == 'undefined')
    runBusRuleCode();

function runBusRuleCode() {
    action.setRedirectURL(current);
    new global.gl_prb_ProblemFormUtils().createProblem(current);
    var server_URI = gs.getProperty('glide.servlet.uri');
    var url = server_URI + '/now/sow/list/params/list-id/8baa687eebd1301080de83402a5228e8/tiny-id/' + current.cmdb_ci ;

    var message = '<a class="web" target="_blank" href="' + url + '">Please click here to view the problem record list for the selected CI</a>';
    //var message = "<p>There is already problem record available for the selected CI." + link + "</p>";
    gs.addInfoMessage(message);
}

2 REPLIES 2

Michael Fry1
Kilo Patron

This is a workspace that's configured in UIB? If yes, you should create the button in UIB.

Yes I have created button in that scoped.