How to make the comment field mandatory in portal, after clicking the Reopen button

Arjun Kumar Le1
Tera Contributor

How to make mandatory the comment field in portal, after clicking the Reopen button, please help me what change i need to make in the code?

 

note: The comment in the differnt widget

 

ArjunKumarLe1_0-1690793857852.pngArjunKumarLe1_1-1690793858693.png

be low is the given code:

Body HTML:

 

<div ng-show="data.showReopen" class="panel panel-default">

 

<div class="panel-heading">Actions</div>

<div class="panel-body">

<button type="button" class="btn btn-primary btn-block" ng-click="c.uiAction('reopen')">Reopen Incident</button>

</div>

</div>

 

Server

 

(function() {

 

    // Get table & sys_id

    data.table = input.table || $sp.getParameter("table");

    data.sys_id = input.sys_id || $sp.getParameter("sys_id");

 

    // Valid GlideRecord

    gr = new GlideRecord(data.table);

    if (!gr.isValid())

        return;

 

    // Valid sys_id

    if (!gr.get(data.sys_id))

        return;

    //Button Visibility

    if (data.table == 'incident' && (gr.state == 6 || gr.incident_state == 6)) {

        data.showWidget = true;

        data.showReopen = true;

 

    } else {

        data.showWidget = false;

        data.showReopen = false;

    }

 

 

 

    if (input && input.action) {

        var action = input.action;

 

        // If Incident table

        if (data.table == 'incident') {

            if (action == 'reopen') {

                // Reopen Incident

                gr.setValue('incident_state', 2);

                gr.setValue('state', 2);

                gr.update();

            }

 

        }

    }

 

})();

 

 

 

Client controller

 

 

function MyFunction() {

        var c = this;

        c.uiAction = function(action) {

            if (!confirm("Are you want to reopen?")) retrurn;

            c.data.action = action;

            c.server.update().then(function() {

                c.data.action = undefined;

            });

                                };

}

 

 

Link:

 

 

function link(scope, element, attrs, controller) {

 

 }

0 REPLIES 0