Pass spModal value to another widget

Vikram3
Giga Guru

I have a spModal where I am getting a value from URL and placing it in client script value. Below is the code.

function(spModal) {
  var c = this;
  c.onWidget = function(widgetId, widgetInput) {
        spModal.open({
            title: 'Watch List',
            widget: widgetId,
						buttons:[],
						value:c.data.value,
            widgetInput: widgetInput || {}
        }).then(function(){
            console.log('widget dismissed');
        })      
    }}

I need to pass the spModal value to another widget..

1 ACCEPTED SOLUTION

You can access as 

input.value in server

View solution in original post

8 REPLIES 8

Jon Barnes
Kilo Sage
Are you wanting to share the value from c.data.value with the widget that you are displaying inside the spModal? If so you can add it to widgetInput and it will be available in your embedded widget. If that is not what you are looking to do, it may help if you explain your use case further.

Vikram3
Giga Guru

Yes exactly. But how to use widgetInput? Can you please guide me here. Thanks in advance.

Hi Vikram,

 

In the previous post, I think I have answered the same. I have shown you how to pass widget input,

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

Hi Shweta,

Thanks for pitching back in. Yes I provided the value like this.

widgetInput: {"value":c.data.value}

Now how to retrieve this value in my watchlist widget?

Below is my watchlist widget code. Let me know how to use this.

find_real_file.png

Thanks in advance.