
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 05:29 AM
Hello All,
I was stuck on this particular point and hope someone can point me in right direction.
I want to create a reusable widget (say a modified date picker), I would use it as a variable in multiple catalog items. Now, I'd like some options to dynamically change based on some options specified at the variable definition. (I could store them in a different table in future, but for simplicity assume that one additional field stores this information on 'item_option_new' table. My question is how can I identify which variable is being called in widget's server script?
In client controller I can get this information by using $scope.page.field.sys_id. But, I'd like to have this information at the server side so that I could provide the options from server side.
-Mandar
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2018 02:43 AM
I completely understand what you're trying to do... or so I think. I'm in the same boat.
I have a catalog item on the Service Portal to where I added a macro variable that loads a widget:
Now, when this widget loads, I want to grab the sys_id of the calling catalog item because in the Server Script, I want to query the item_option_new table to get the sys_id's of all the variables:
When the widget initially loads, it runs the Server Script and that's where I can't seem to get the sys_id of the calling catalog item... the same issue you're having.
The only way that I've found do what you're trying to do is by doing this:
However, this is not the way I want to go about it. I need to grab that sys_id before any of the HTML Template code gets rendered.
I forked this into my own question in the Developer Community here (my Developer Community post)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 05:36 AM
I did not understand fully, i have one point to say like same variable want to use in multiple catalog items
go with variable set and create variable in that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 05:45 AM
Hey Balaji,
I'm using Service Portal. And the calendar picker would be a widget. So that I can use the widget option in variables default value to use it. So, the question above is referring to the server side /client controller part from Service Portal widget.
I hope that makes the question clearer now.
-Mandar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2017 02:03 AM
I guess, I've complicated the question.
All I want to know is, if there's a way we can fetch the variable sys_id value at the server side? Same value that we get at client side using page.field.sys_id?
-Mandar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2017 02:09 AM
Hi Mandar,
I believe you must be using in your server side code in your GlideRecord etc. I have an alternative for this. You can use the GlideRecord in client controller itself with callback function. It will also work on client side. I am not sure whether this is the best way to achieve this or not but this will help you to accomplish your task.
Hope this helps.
Regards
Ujjawal