spModal WidgetInput not working?

lucr
Kilo Expert

Hi Everyone,

Quick question. I'm working on a set of Service Portal widgets. And I want to open a widget within a modal as popup.

function(spModal) {

  /* widget controller */

  var c = this;

  c.onAction = function(title, action) {

  // ask the user for a string

  // note embedded html in message

  spModal.open({

  title: title,

  widget: 'drdc-action-modal',

  widgetInput: {

  action: action,

  environment: 'asdfasdfsafd'

  }

  }).then(function(){

  console.log('widget dismissed');

  })  

  }

}

So this is the quick and dirty code. Copied from the github help pages.

The popup/modal opens just fine however the options are not passed through to widget. If i dump the complete options it just outputs:

{"sp_widget_dv":"","sp_column_dv":"","active":false,"sys_tags":"","order":-1}

Do you guys no what i'm doing wrong?

Thnx in advance!

Maybe there is some other feature not using spModal?

Kind regards,

Luc

6 REPLIES 6

ohhgr
Kilo Sage
Kilo Sage

Just Checking, did you find a solution to this?

 

Thanks,
Mandar

ankitbadola
Giga Expert

Could you please let me know how to use widgetInput attributes in the widget client or server side which is calling the model itself .

 

widgetInput: {

  action: action,

  environment: 'asdfasdfsafd'

  }

xiaix
Tera Guru

For me, I can never get the ".then()" to ever trigger.

 

}).then(function(){

  console.info('widget dismissed');

})

 

Nothing ever gets logged to the console.

Syvo
Mega Guru

Hi there,

I'm answering this thread because I found it on ... my default search engine while trying to understand why I couldn't see my widget server code logs when my widget was opened with spModal.

The documentation for spModal is correct, you get the "widgetInput" object as "input" in your server script.

What puzzled me for nearly an hour was that I couldn't see the output of $sp.log in my browser console in this case, making me think that my server script was not running. I hope it will help someone in the same situation.

/Sylvain