Service Portal Widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 11:06 AM - edited 05-13-2024 07:19 AM
Hello everyone,
I am looking for some help.
I am trying to send the selected value from user from client side to server side. The value successfully getting sent to the server side but I am not sure what exactly should be the server side script to fetch this value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 02:13 PM
Hi @SohaP,
Can you elaborate on what you are trying to do?
Are you trying to invoke a function within a Script Include and pass back its output?
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 02:47 PM
Hi @James Chun,
I am trying to store the value of selected option in a server side variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 03:01 PM
Try replacing the following clinet script:
$scope.selectedOption = option;
$scope.selectedAction = action;
// Making an HTTP POST request to send the selected option to the server
$http.post('/sys_script_include_name.do', { option: option })
.then(function(response) {
$scope.saveStatus = response.data;
alert('Selected option sent to server successfully:', response.data);
})
.catch(function(error) {
alert('Error sending selected option to server:', error);
});
};
to
c.server.get({
action: "passClientValue",
selectedOption = option,
selectedAction = action
}).then(function(response) {
//do some processing from reponse if reqired
});
And your Server script will be:
if(input && input.action == 'passClientValue')
{
var selectedOption = input.selectedOption;
var selectedAction = input.selectedAction;
//Write some script here
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2024 02:47 AM
I tried this script but unfortunately it is also not working.