spModal - How to pass values from spModal to original widget

Saran Ramayanam
Tera Expert

Hi Everyone,

 

I am using spModal in page to open a new record in a table (opening form widget in spModal), i have passed sys_id,table name and view in parameters(WidgetInput), how can i get output of that form after creation say sys_id??? and how to close the modal after selecting save or submit in embedded widget

 

spModal.open({
            title: label,
            widget:'widget-form', //FORm WIDGET
	buttons: [{label:'${Close}', cancel: true}],
	size:"md",
           widgetInput: {sys_id : -1,table : TABLE_NAME,view : 'new_record',disableUIActions : false}
        }).then(function(){
            console.log('widget dismissed');
        })      
5 REPLIES 5

sachin_namjoshi
Kilo Patron
Kilo Patron

Please see solution below

 

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

 

Regards,

sachin

Hello Sachin,

 

I want the sys_id of new record from the embedded widget, the above community link gives me about how to pass inputs to embedded widget which i already k ow

 

Regards

Saran

Hi @saranramayanam ,

 

Were you able to get this done ? I am also stuck trying to do same

anishareddyg
Kilo Contributor

Hi @saranramayanam ,

 

You can close it by using   $scope.$parent.$parent.$dismiss(); in your client script on click of those buttons.