Mandatory additional comments in portal

Hafsa1
Mega Sage

I have created a button to change case status to WIP if end user hit this button.

But i need to make additional comments mandatory before hitting this button. how to achive it.

 

Hafsa1_1-1734080455449.png

 

code is:

HTML

<button type="button" class="btn btn-primary btn-block" ng-click="c.uiAction('change_state')">Move to WIP</button>

 

Client Controller

 

c.uiAction = function(action) {
c.data.action = action;
c.server.update().then(function(response) {
c.data.action = undefined;


if (response.data.success) {
alert("State changed successfully!");
$window.location.reload();
} else {
alert("Failed to change state. Please try again.");
}
});
};

 

server side:

if (input && input.action === 'change_state') {
// Load the current record
var gr = new GlideRecord('sn_customerservice_case');
if (gr.get(input.sys_id)) {
gr.state = 11; 
data.success = true; 
} else {
data.success = false; 
}
}

 

 

0 REPLIES 0