Need help in report knowledge gap ui action for incident in native UI

Badrinarayan
Tera Guru

I want to have report knowledge gap button on incident , where a pop up to be displayed with short description populated in that and , when i submit the knowledge gap , feedback task to get created

here is my code , please help

function reportKnowledgeClient() {
    var shortDescription = g_form.getValue("short_description");

    var modalHTML =
        '<div>' +
        '<h3>Report Knowledge Gap</h3><br>' +
        '<label><b>Topic</b></label><br>' +
        '<input id="feedback_topic" class="form-control" type="text" style="width:100%; padding:4px;" value="' + shortDescription + '"/><br><br>' +
        '<label><b>Description</b></label><br>' +
        '<textarea id="feedback_description" style="width:100%; padding:4px;" rows="5"></textarea><br><br>' +
        '<button class="btn btn-primary" id="feedback_submit">Submit</button> ' +
        '<button class="btn btn-secondary" id="feedback_cancel">Cancel</button>' +
        '</div>';

    var modal = new GlideModal("Report Knowledge Gap");
    modal.setSize("default");
    modal.renderWithContent(modalHTML, function() {
        // Handle Submit
        document.getElementById("feedback_submit").addEventListener("click", function () {
			alert("clicked");
            var topic = document.getElementById("feedback_topic").value;
            var description = document.getElementById("feedback_description").value;

            var ga = new GlideAjax("IncidentUtils2");
            ga.addParam("sysparm_name", "getKnowledgeGapMapping");
            ga.addParam("sysparm_incident", g_form.getUniqueValue());
            ga.addParam("sysparm_topic", topic);
            ga.addParam("sysparm_description", description);

            ga.getXMLAnswer(function(response) {
                // Show the response (the answer returned from server)
                alert("Server says: " + response);
                modal.destroy(); // close modal
            });
        });

        // Handle Cancel
        document.getElementById("feedback_cancel").addEventListener("click", function () {
            modal.destroy();
        });
    });
}
1 REPLY 1

Rajeevreddy
Tera Expert

Hi Badri ,

 

Any update on this we are also exploring the option to implement on incident any help