- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 07:29 AM - edited 06-21-2024 07:30 AM
Hello Guys!
In Service Portall, I have a Variable Set Multirow that has a text field called "Ports".
If the "Ports" field has the number 22, it defines a selectbox variable outside the Multirow as "YES", however, I am not able to make this value change in this selectbox variable.
function onSubmit() {
//Type appropriate comment here, and begin script below
var getPortValue = g_form.getValue('ports');
if (getPortValue.includes("22")) {
alert(getPortValue);
g_form.setValue('port_22_normal', 'yes');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 07:37 AM
Hi @Guilherme Popo2,
Sure, here is a concise version of your script that handles the multi-row variable set to check for the value "22" in the "Ports" field and sets the selectbox variable accordingly:
function onSubmit() {
var multiRowValues = g_form.getValue('multi_row_variable_set'); // Replace with the actual variable set name
var containsPort22 = false;
multiRowValues.forEach(function(row) {
if (row.ports.includes("22")) { // Replace 'ports' with the actual field name
containsPort22 = true;
}
});
if (containsPort22) {
g_form.setValue('port_22_normal', 'YES'); // Replace with the actual selectbox variable name
}
}
Replace the placeholders:
- `'multi_row_variable_set'` with your actual multi-row variable set name.
- `'ports'` with the actual name of the "Ports" field.
- `'port_22_normal'` with the actual name of the selectbox variable.
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 07:37 AM
Hi @Guilherme Popo2,
Sure, here is a concise version of your script that handles the multi-row variable set to check for the value "22" in the "Ports" field and sets the selectbox variable accordingly:
function onSubmit() {
var multiRowValues = g_form.getValue('multi_row_variable_set'); // Replace with the actual variable set name
var containsPort22 = false;
multiRowValues.forEach(function(row) {
if (row.ports.includes("22")) { // Replace 'ports' with the actual field name
containsPort22 = true;
}
});
if (containsPort22) {
g_form.setValue('port_22_normal', 'YES'); // Replace with the actual selectbox variable name
}
}
Replace the placeholders:
- `'multi_row_variable_set'` with your actual multi-row variable set name.
- `'ports'` with the actual name of the "Ports" field.
- `'port_22_normal'` with the actual name of the selectbox variable.
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 08:01 AM
Hello @Yashsvi Thank you so much, It worked