Hello,
The checkbox in the Interactive Grid returns the wrong value on change.
I created a dynamic action of type "Selection Change [Grid]" to get the checkbox value and refresh the grid based on that value.
The checkbox is supposed to return 'Y' when checked and 'N' when unchecked. However, when I check the box, it returns a null value. If I double-click and focus on the checkbox field, it correctly returns 'Y'.
When I check and then uncheck again the box, it returns N , even though it should return 'Y' when checked and 'N' when unchecked.
Has anyone else encountered this behavior in the Interactive Grid?
What is the solution, please?
Here is my code:
var model = this.data.model;
// Check if there is a selected record
if (this.data.selectedRecords[0] && this.data.selectedRecords[0].length > 0) {
// Get the selected record
var record = this.data.selectedRecords[0];
// Get the "ROLE_NAME" value
var roleColumnValue = model.getValue(record, "ROLE_NAME");
// Get the "ENABLED" checkbox value
var checkboxValue = model.getValue(record, "ENABLED");
console.log(checkboxValue);
// Check conditions
if (roleColumnValue === "MAST_MIS" && checkboxValue === 'Y') {
apex.message.confirm('Role not permitted for Input User', function(confirmed) {
if (confirmed) {
model.clearChanges(); // Clear any unsaved changes
// Optionally, if you want to uncheck it directly without refresh:
// model.setValue(record, 'ENABLED', 'N');
apex.region("ALLOW_ROLES").refresh(); // Refresh the region
}
});
}
}