Reputation: 565
I want to access extra page item value from a trigger which isn't in the related data table. For an example I have a table like below,
Employee
----------------------
empId | fName | lName
----------------------
1 | John | Doe
----------------------
2 | Jane | Doe
Apex form items will be like,
P500_EMPID, P500_FNAME, P500_LNAME
I have an extra page item called P500_SOMEIDS
which is a multi select list. I want to access those selected values inside After Insert
trigger of the Employee
table. I tried to add this item into "Page Items to Submit". But I do not know how to access it inside that trigger. Is it possible..? and How..?
Upvotes: 0
Views: 2254
Reputation: 18665
In the page process that handles your table update (that will be a process of type "Form - Automatic Row Processing (DML)", under "Settings" there is a attribute "Return Primary Key(s) after Insert". If that is set to "On", then the insert statement will return the value of the inserted row into the page item that is defined as your primary key. Example:
If you want to insert rows into another table referencing the newly created empno then you can create a page process (that executes after the row processing) of type pl/sql code like this:
BEGIN
INSERT INTO some_other_table (empno) VALUES (:P1_EMPNO);
END;
Using triggers for business functionality should be avoided whenever possible.
Upvotes: 3
Reputation: 142733
Instead of a database trigger, use a stored procedure which will do the same job. Pass any number of parameters you want (including the P500_SOMEIDS
item).
Upvotes: 1