\$sp.getParameter("sys_id") returning "null" value in Service portal

DUGGI
Giga Guru

I am using $sp.getParameter("sys_id") in widget ,but it retun null,

anyone can help on this ?

15 REPLIES 15

scottl
Kilo Sage

I'm having the same problem with $sp.getParameter("xxxx") too.



It's not just the "sys_id", I'm finding that all GET vars in the URI when the record watcher refreshes the Model/Server Script for that Widget are NULL.



I hope someone has a work around, anyone?   Also does anyone have access to HI, as this might actually be a bug.


renaud3
Giga Contributor

It seems Scott is right based on the gitHub issue comment:



access to $sp.getParameter('sys_id') from embedded widget. · Issue #32 · service-portal/documentat...



Here is the comments on the unofficial github documentation:


deconroy commented on 29 Jun



$sp.getParameter() does not currently work within embedded widgets. I am not sure if it is coming in a future patch or not.


What you can do to get these parameters in an embedded widget is to pass them in as either input, or options into the embedded widget. The recently updated embedded widget documentation explains how to provide options or input to en embedded widget.


Hope this helps.


Dan


My issue isn't directly related to embedding widgets.   However, I think if you use a watcher on that embedded widget you'll find the same issue as me and I don't think that the input or options will work, because as soon as the watcher runs, it only runs the model, while ignoring any data built within the controller, thus deleting it from the view. Is this another "undocumented feature", or is this "working as expected"?


renaud3
Giga Contributor

I don't know, you probably should raise an issue in the github for more info.