- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018 02:52 PM
Hi Community,
has anyone come up with a slick way to do this? Example is for having one variable on a form that can display a different Question depending on other variables.
Use case is for a record producer where the logged in user can request to be added to, or removed from groups in ServiceNow. I'd like to use one list collector type variable to handle this, but to have it say "Please select the groups you'd like to be added to" OR have it say "Please select the groups you'd like to be removed from" based on which the user has decided to do (by selecting from a separate variable).
As far as I know this is not possible in Service Portal, but maybe someone has come up with a cool solution? thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018 02:58 PM
Hi,
I doubt that would be possible. Only way I can some up with besides Client scripts is to have two variables and then UI Policies that hide/show the two different variables.
Last thing I can come up with might be try to use the gs.getMessage, so depending on what they choose, you get a different label. Problem here is that the variables is handled quite deep in and not so easy to modify the widget that shows them the correct way.
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018 02:58 PM
Hi,
I doubt that would be possible. Only way I can some up with besides Client scripts is to have two variables and then UI Policies that hide/show the two different variables.
Last thing I can come up with might be try to use the gs.getMessage, so depending on what they choose, you get a different label. Problem here is that the variables is handled quite deep in and not so easy to modify the widget that shows them the correct way.
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018 03:01 PM
Thanks Göran, that's what I was thinking too. In one use case I've got there are potentially hundreds of options for the Question on a specific variable already in place for a single Software Asset Request catalog item. So I agree that the multiple variables and UI Policies is a good way to go if the scope is small, in this case it's not feasible.
I appreciate the response!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018 04:03 PM
Hmm.. That it might not be so fun 😃 I think thou you can create another variable and reuse the choices from the first one. Never done it myself, it always been reusing choices from other tables.
Otherwise I guess coming up with a good label that fits both purposes is the way to go (and easiest to administrate 😛 )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2024 06:39 AM
you can do an OnChange ClientScript tha would look like this
make sure you select the collector variables as variables name then
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
// Example: Change the label of variable "question2" based on "question1"
if (newValue === 'option1') {
g_form.setLabel('question2', 'New Label for Question 2');
} else {
g_form.setLabel('question2', 'Default Label for Question 2');
}
}