other than prompt what can be used to display a pop up in widget which should be non mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I have Approve button for Demand, so when we click on the button it should display a pop up. Approvers should have the option to add comments when approving, but this should remain optional (not mandatory). Th Approve button is implemented in a widget.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
please share complete widget code
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Client controller code :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
updated client controller, all other is same
function ($scope, spUIActionsExecuter, spUtil, spModal) {
var c = this;
var ESIGNATURE = {
"approved": "cbfe291147220100ba13a5554ee4904d",
"rejected": "580f711147220100ba13a5554ee4904b"
};
spUtil.recordWatch($scope, "sysapproval_approver", "state=requested^sys_id=" + c.data.sys_id);
c.action = function(state) {
if (c.data.esignature.e_sig_required) {
var requestParams = {
username: c.data.esignature.username,
userSysId: c.data.esignature.userSysId
};
spUIActionsExecuter.executeFormAction(ESIGNATURE[state], "sysapproval_approver", c.data.sys_id, [], "", requestParams).then(function(response) {
});
} else if (state == 'rejected') {
if (c.data.no_comment_rejection == 'true') {
c.data.op = state;
c.server.update().then(function() {
if (!c.data.updateID) // update failed
spUtil.addErrorMessage(c.data.actionPreventedMsg);
else
c.data.state = state;
});
} else {
if (c.data.reject_raison_label) {
var shared = {};
spModal.open({
title: 'Rejection',
widget: 'reject_raison',
keyboard: false,
widgetInput: { label: c.data.reject_raison_label, options: c.data.reject_raison_options },
shared: shared
}).then(function() {
if (shared.select == '' || shared.select == null) {
spModal.alert(c.data.reject_raison_label + ' mandatory');
} else {
c.data.comments = shared.select + '';
c.data.op = state;
c.data.reject_raison = 'true';
c.server.update().then(function() {
if (!c.data.updateID) // update failed
spUtil.addErrorMessage(c.data.actionPreventedMsg);
else
c.data.state = state;
});
}
});
} else {
spModal.prompt("Please enter reason for rejection").then(function(rejectReason) {
c.data.comments = rejectReason;
c.data.op = state;
c.server.update().then(function() {
if (!c.data.updateID) // update failed
spUtil.addErrorMessage(c.data.actionPreventedMsg);
else
c.data.state = state;
});
});
}
}
} else if (state == 'approved') {
spModal.prompt("Please enter reason for Approval (optional)").then(function(acceptReason) {
// Allow empty or undefined comment
if (acceptReason !== undefined) {
c.data.comments = acceptReason;
}
c.data.op = state;
c.server.update().then(function() {
if (!c.data.updateID) // update failed
spUtil.addErrorMessage(c.data.actionPreventedMsg);
else
c.data.state = state;
});
});
}
};
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
There is no difference, when clicked on approve button and if we don't enter comment also the demand should be approved but with the above code pop up is display and ok button is greyed out we wont be able to approve the demand without entering the comments.
I need a pop up when clicked on approve button and when no comment is entered also the demand should be approved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
why not use simple text box and have 2 buttons cancel and ok?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader