Oracle APEX – Save Selected Row IDs from Interactive Grid to a Page Item

I am a Certified Oracle Cloud Expert and APEX Developer, specializing in Oracle Fusion SCM modules, BI, OTBI, FDIP, and OIC solutions. Skilled in requirement analysis, application development, SQL/PLSQL programming, and full project lifecycle management. I have delivered integrated, high-performing solutions across Finance, HR, Procurement, Inventory, and Order Management. Passionate about leveraging technology to solve complex business problems and streamline processes. I’m here to share my understanding and contribute to meaningful discussions.
Sometimes you need to store the IDs of selected rows in an Interactive Grid so you can use them later in processes, validations, or dynamic actions.
In this guide, we’ll store selected IDs into a hidden page item called P4_SELECTED_PARTY_ID.
1️⃣ What We Want to Do
When the user selects rows in the Interactive Grid:
The primary key values (usually an ID column) will be saved.
They will be stored in
P4_SELECTED_PARTY_IDas a comma-separated list.
Example:
If you select two rows with IDs 123 and 456, the page item will contain:
123,456
2️⃣ Steps to Set It Up
Open Page Designer for your page.
Select your Interactive Grid region.
In the Property Editor, go to Attributes.
Find Initialization JavaScript Function.
Paste this code:
function (options) { options.defaultGridViewOptions = { selectionStateItem: "P4_SELECTED_PARTY_ID" }; return options; }3️⃣ How It Works
selectionStateItemtells APEX to store the selected primary key values in the given page item.The values are comma-separated.
You can use
P4_SELECTED_PARTY_IDin:Processes (e.g., to update multiple rows)
Validations (check if the user selected something)
Dynamic Actions (run something based on selected rows)
With this setup, you can easily use selected row IDs anywhere in your page logic.
🔗 Connect with Me
sridharutukuri@gmail.com | Linkedin | Github
Disclaimer
This content is based on my personal learning, experiments, and publicly available resources, including the Oracle APEX documentation and other community articles.
It is written for educational purposes only and reflects my own understanding and opinions.
This post is not affiliated with, endorsed by, or sponsored by Oracle, my current employer, or any organization I am associated with.
