Making catalog task variable mandatory in the sctask form based on sc_task state and another variabl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2024 05:10 PM
Could you please help me to make a variable mandatory in the sc_task form based on sc_task state and another varaible
Please help....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2024 08:06 PM
Try this template for a catalog client script on change
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
// Get values of the dependent variable and state
var dependentVariable = g_form.getValue('u_dependent_variable'); // Replace with your dependent variable's name
var state = g_form.getValue('state'); // Replace 'state' with the relevant field, if exposed
// Condition to make the target variable mandatory
if (state === '3' && dependentVariable === 'specific_value') { // Replace with actual values
g_form.setMandatory('u_target_variable', true); // Replace with your variable's name
} else {
g_form.setMandatory('u_target_variable', false); // Optional otherwise
}
}