I have a page item P2_ITEM_TYPE_ID that gets set in Pre-Render, using a process calling PL/SQL:
BEGIN
select ITEM_TYPE_ID INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
exception
when no_data_found then
:P2_ITEM_TYPE_ID := null;
END;
Currently the record for that ITEM_ID does not exist in TABLE1 so the exception NO_DATA_FOUND is thrown and originally the ITEM_TYPE_ID is set to null.
Now I want to set the ITEM_TYPE_ID by clicking on one of the cards on the page, grabbing its ID and setting page item P2_ITEM_TYPE_ID to that ID.
I have a dynamic action that runs the following javascript when card is clicked:
var $item_type_id = this.data;
console.log($item_type_id); //prints out correect ID
apex.item("P2_ITEM_TYPE_ID").setValue($item_type_id);
console.log(apex.item("P2_ITEM_TYPE_ID").getValue()); //prints out correct value
//set session state of P2_ITEM_TYPE_ID
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE",
{
x01: $item_type_id,
pageItems: "#P2_ITEM_TYPE_ID"
},
{dataType: 'text'} );
I know the code works, as the correct values get printed to the console, but when I check the session of the page, P2_ITEM_TYPE_ID is blank in session. What could be the problem?
It is almost as if something is preventing th value from changing. I have identical setup on another page with one small difference - the code in the pre-render does not include the exception part because there is always a record in TABLE1 for that ITEM_ID:
BEGIN
select ITEM_TYPE_ID INTO :P3_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P3_ITEM_ID;
END;
But the rest of the code is identical and session of P3_ITEM_TYPE_ID changes without an issue