Closing spModal window

davilu
Mega Sage

Hi Experts, I have a modal window in my SP Widget that I'm trying to close or dismiss onSubmit, but can't seem to get it to work.  

What do I need to add to the below code in order for the modal window to close upon pressing the submit button?

c.onWidget = function(widgetId, request){

spModal.open({

title: 'Check-in',

widget: widgetId,

buttons: [],

widgetInput: {table: 'x_138031_myTable',

sys_id: request.id,

}

}).then(function(){

console.log('widget dismissed');

});

3 REPLIES 3

ChrisBurks
Mega Sage

This post should help:


jpierce.cerna


Oops copied wrong link. the post was made by him. Here's is the real link:



https://community.servicenow.com/thread/260164#1120053


jpierce_cerna
Tera Contributor

The original post didn't come through in Chris's reply. You can find the details of it here in this post (see the 8th paragraph):


https://www.cernasolutions.com/portal-pet-adoption-thoughts-modals/


Satyanarayana C
ServiceNow Employee
ServiceNow Employee

Instead of buttons: [] use below code:



buttons: [


  {label:'Cancel', cancel: true},


  {label:'Submit', primary: true}


  ]