Store data in table using service portal widget and fetch data from table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2023 05:10 AM
Hello All,
I want to store data in a table from a widget after that I want to fetch data from that .how can I achieve this functionality can anyone please guide me on this?
Thank You.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2023 05:54 PM
To transfer data from server side to client side, one writes code in the Server script section of a widget, where data is loaded from the database and added to global object variable data.
One needs to keep in mind that the Server script is executed under two circumstances:
- when the page and thus the widget is loaded and
- when the client side "calls back" requesting data.
In the latter case a global object variable input is defined and contains parameters for the request.
To transfer data from client side to server side one can call several methods. These methods are c.server.get(), c.server.update() and c.server.refresh(). The 1st to are meant to transfer data between the client and the server after page load, while the last one is just that: refreshes the widget's data and option objects as if it was loaded.
Official documentation: