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.

How to get Multiple Line Text Prompt on service portal

Ankita Gupte
Kilo Sage

Hello, I have a prompt on service portal that when approver clicks on reject widget, it show to enter mandatory comment in single line text. I want is multiple line text. How can I achieve this?

find_real_file.png

Server script of widget is:

if (input) {
// update pagination
currentPage = input.pagination.currentPage;
initRow = (currentPage * maxNumberOfItemsInTheList);
lastRow = initRow + maxNumberOfItemsInTheList;

if (input.op == 'approved' || input.op == 'rejected') {
var app = new GlideRecord("sysapproval_approver");
if (app.get(input.target) && app.state.canWrite()) {
app.state = input.op;
if(input.op == 'rejected')
{
app.comments = input.reject_comment;
}
app.update();
}
}
}

Client Script of widget is:

$scope.reject = function(id, esigRequired) {

spModal.open({
title: 'Reject Approval',
message: 'Please enter your reason for rejection, note this will be communicated with the requestor',
input: true,
value: $scope.name
}).then(function(name) {
$scope.name = name;

var requestParams = {
username: $scope.data.esignature.username,
userSysId: $scope.data.esignature.userSysId
};

if($scope.data.esignature.e_sig_required && esigRequired) {
spUIActionsExecuter.executeFormAction(ESIGNATURE.REJECT_SYS, "sysapproval_approver" , id, [] , "", requestParams).then(function(response) {
});
} else {
$scope.data.op = "rejected";
$scope.data.target = id;
$scope.data.reject_comment = "Rejection reason: " + $scope.name;
get();
}
});
};

7 REPLIES 7

Try this

'Please enter your reason for rejection \
note this will be communicated with the requestor';

you can use \ between words to break lines

I want string field where approver will enter his answer wants multiple line field.

find_real_file.png

 

That can not be possible in spModal to show multi-line text in the prompt you have to go for customized modal window.

I found this I hope it's the same as per your requirement, this might help you 

https://community.servicenow.com/community?id=community_question&sys_id=01654358db30d3042d1efb651f96...