How to access widget input passed from a catalog client script?

Raskill1
Giga Contributor

Hi Experts,

I have a pop up modal that displays instructions right after I submit a catalog item, I am trying to achieve this using, an OnSubmit catalog client script,

function onSubmit() {
	//Type appropriate comment here, and begin script below
	
	if (typeof spModal != 'undefined' && !g_scratchpad.checkFlag)
		{
		spModal.open({
			title: 'Read Me',
			widget: 'read_me_widget',
			widgetInput: {cat_sys_id: '2f918ad6e8999add2918ad6e843', variable_name: 'nothing'}
		}).then(function(confirmed)
		{
			if(confirmed)
				{
				g_scratchpad.checkFlag = true;
				g_form.submit();
			}
			else
				{
				g_scratchpad.checkFlag = false;
			}
		});
		
		return false;
	}
}

As you can see I am trying to pass the widgetInput object which holds the cat_sys_id as well as a variable_name. In the read_me_widget, I was supposed to fetch them values in the input object but I am unable to do so. However, when I try embedding a widget using spModal on another widget client controller, the same seems to work fine.

Any help or pointers in the right direction is highly appreciated!

Thanks,

Raskill

2 REPLIES 2

Ct111
Giga Sage

Hello,

 

I think the below link is worth checking 

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

 

Plz reference it.

 

Mark my ANSWER as CORRECT and HELPFUL if it works

Raskill1
Giga Contributor

Thanks creativethinker to the post. Although it speaks little of how the server side code of the target widget is able to access the widgetInput.