Passing server script data into client controller widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 04:53 PM
My team and I are novices to the backend of the ServiceNow platform, so we were asking if there was a way to inject data via the backend of the service.
We are creating a custom chatbot widget that would link to our service via using our webSDK. The widget would have a .js (.css file also for widget formatting purposes) file integrated. The original plan was to use data in a internal ServiceNow table that could be edited by users of the widget and would be used to generate a replacement .js file. However, we have had problems trying to generate a replacement .js file in the ServiceNow platform, so we have decided to consider widget scripts to update the widget, preferably on site refresh. We are trying to get the scripts to pass sample data, so we will work on importing the client table at a later time.
Is this a correct way to pass sample data strings from the server script in the widget to the client controller, so that it can update the widget's data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 09:45 PM
Anything stored in server side with data.var_name; can be called in client side with c.data.var_name.
Thats the correct way to get server data in client controller.
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 11:38 PM
@Gabriel Aguiar pls mark the relevant answer correct so that other visitors with same query can get benefit from same.
Raghav
MVP 2023