Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Pass spModal value to another widget

Vikram3
Tera 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

Use below code,

in server side

options.name_of_option

in client 

c.options.name_of_option

You can access as 

input.value in server

Community Alums
Not applicable

Hello Vikram,

I am also stuck in the same scenario. I need to pass data from one widget to another widget, second widget display over spModal popup.

 

In widget 1 , below is the code for calling spModal and adding widget:

 

$scope.getdata = function(data)
{

spModal.open({
title: "Invoice Detail - #"+data.invoice,
widgetInput: {"value": data.invoice},
widget: 'invoice_details',
buttons: [
]
}).then(function(response)
{

});

 

could you please guide me how i can access this data in second widget.

Hi,

Use input.server in server script