I’m trying to get the ID from a selected row in an Interactive Grid, set it to an hidden page item, and when clicking on a button redirecting to another page, setting the value of the hidden item from the previous page to an item of the target page.
The simplified use-case is : There’s is a master/sub-master/detail page. When clicking on the master record, the submaster refresh and display the data related to the master report. When clicking the submaster, the detail report refresh and display related data. When the user click on the submaster, I want to store the ID of the row in an hidden item. When the user wants to create a new record, I want the button to pass the value of the Hidden Item to an Item on the target page (Popup-LOV).
Here’s what I did :
Hiden Item
Dynamic action Code to store the value of the Item
- Selection change
- Execute JavaScript Code (source : https://stackoverflow.com/a/76573612/16453533)
const model = this.data.model,
records = this.data.selectedRecords;
let values = records.map( r => model.getValue( r, "PK_CONCE" ) );
apex.item( "P16_PK_CONCE" ).setValue( values[0] );
console.log(apex.item("P16_PK_CONCE").getValue());
The value is passed to the hidden item, I can track it using console.log
:
Button config
However, when going to the target page using the button, the value is not passed
The hidden item value still is accessible using $v(ITEM)
command, but the target item is empty
I don’t understand what’s the problem here, is the value not persisted through pages when dynamically being set in JavaScript ? Is there another way to do it ?
Thanks in advance