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
is that widget custom?
If yes then you can have your own logic to add a comments box
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
yes its a widget custom. I have the following code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
try this
if (state == 'approved') {
if (c.data.label == 'Demand') {
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) {
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
yesterday
The OK button is greyed out with which we cannot approve without entering comment