I’m currently having trouble setting an item upon page load. It seems that the value is being stored only on the client side, not on the server side.
While the current behavior works properly when checked in the console, the item is not set during the initial load of the Interactive Grid. The page needs to be re-submitted before the value is actually stored in the item.
Here's my sample code below.
"IG1", "IG2", "IG3", "IG4", "IG5", "IG6" ]; var found = false; // Loop through grid IDs to find the visible one for (var i = 0; i < gridIds.length; i++) { var regionId = gridIds[i]; var region = apex.region(regionId); // Check if region exists and is visible if (region && region.widget().is(":visible")) { var ig$ = region.widget(); var model = ig$.interactiveGrid("getViews", "grid").model; var fieldKey = model.getFieldKey("STATUS"); model.forEach(function(record) { var value = record[fieldKey]; console.log("Field value:", value); if (value === 'ERROR') { found = true; apex.item("P1_ERROR_FLAG").setValue("ERROR"); return false; // break loop } else if (value === 'WARN') { found = true; apex.item("P1_WARN_FLAG").setValue("WARN"); return false; // break loop } }); break; // exit loop after handling the visible grid } } console.log("Value exists:", found);```