How to pass a value from Client Script to Server Script in widget Service portal ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2018 02:47 AM
Hi,
In Client script, created a variable whose value is URL of the Service Portal. How to pass that value to the Server Script in widget.
Thanks in Advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2018 06:16 AM
Could you give us more information and post the code that you have so far?
If you're wanting to send something to the server from the client in a Service Portal widget, there are a few methods to do that: server.update(), server.get(), and server.refresh().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2018 06:42 AM
Hi gowthamram,
Refer this link ,which will helps you to clear your doubts. :-
I hope this helps. Please mark correct/helpful based on impact....!!!!
Warm Regards,
Priyanka
www.dxsherpa.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2021 10:53 AM
You can pass a value from the client script to the server script in a widget as follows:
Say you have a string value that you want to pass from the client to the server, for example to update the short description on an INC...you set the value as follows:
in Client script:
c.data.short_description = 'this is my new short description';
in the Server script this translates to 'input.short_description'.
So if running a GlideRecord in the server script, it could look like this:
var inc = new GlideRecord('incident');
inc.addQuery('number', 'your INC number');//just for an example
inc.query();
if(inc.next()){
inc.short_description = input.short_description;//this is the value passed from the client
inc.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 10:16 PM
Input.short_description is showing as warn in console.log