Get values of dropdown in client scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 04:59 AM
In Service operations workspace I have created a dropdown and I need to get the values of dropdown and on that basis I'm updating a value in client state parameter. I'm controlling a list filter on the basis of dropdown I'll put in if. How to fetch and use the values in the client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 05:36 AM
Hello @Akki1 ,
Refer below article as a example and update field names and other things as per your req:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
// Get the value of the dropdown
var dropdownValue = g_form.getValue('your_dropdown_field');
// Update the client state parameter based on the dropdown value
g_scratchpad.clientStateParameter = dropdownValue;
// Optionally, you can use the value to filter a list
filterListBasedOnDropdown(dropdownValue);
}
function filterListBasedOnDropdown(value) {
// Implement your logic to filter the list based on the dropdown value
// For example:
var gr = new GlideRecord('your_table');
gr.addQuery('your_field', value);
gr.query(function (gr) {
// Process the filtered list
});
}
Thank you!!
Dnyaneshwaree Satpute
Tera Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 05:49 AM
@Dnyaneshwaree Its about client scripts on workspace through UI builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2024 10:49 AM
Not able to understand fully. Can you share some screenshot of your existing configuration.
How are you setting the values in the dropdown and whats the list component relation with this. What operation you want to handle in UX client script. Please explain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2024 05:44 AM
I have created a dropdown and I want to change the assigned to you tasks to Assigned to group tasks whenever the filter is switched to Your Teams Work. The filter for visualization I have stored in client state parameter and I need to create client script to check the dropdown value and update the client state parameter filter.