Understanding Button path ways in APEX

Posted on 2012-08-10
Last Modified: 2016-10-20
Hi All,

When a page is submitted in APEX, can you describe any way of making the record update conditional on  a Yes/No confirmation box, with the opposite choice running a custom SQL statement:
 1. user clicks Save
 2. prompt user to confirm save
      a. if saved then, update record as per standard Automatic Row Processing (DML)
      b. if not saved then, "UPDATE ACTIVITY_REQUESTS SET STATUS = :P14_STATUS"
(Alternative ways of achieving the same outcome gladly considered)

Additional Information
If you could help me out with a better understanding of buttons that would be great.  These four questions give expression to one 'hole' in my understanding.

Q1) The help given under 'Database Action' in 'Edit Page Buttons' on an APEX form states - "If I do not set this attribute, database processing will execute based on the button name. The button name determines the value of he built-in attribute REQUEST." - what does this mean? can I specify a PL/SQL script somewhere?

Q2) I have created some Processes with ('On Submit - After Computations and Validations'). I have a working knowledge of these, but I don't understand how APEX knows when / which process to run when a button is clicked.

Q3) how do the tags 'DELETE' and 'SAVE' (i.e. see following example) tell APEX which processes / updates / deletions to run?

Q4) I have a funny bug in which I click delete, and the save action is processed.
      i) The Delete button 'Action' is 'Redirect to URL' =

Open in new window

this throws up the expected message box, but the record is never deleted - instead various processes run which are only meant to run when the record is saved.
     ii) the SAVE button Action is 'Defined by Dynamic Action' with '- No Database Action'.  The dynamic action either updates the field 'Status'  or saves the entire record using the following java command:

Open in new window

Question by:_Benaiah
    LVL 1

    Author Comment

    The issue may include they way I've created my Dynamic action
    LVL 1

    Author Comment

    How about specifying the process using an AJAX call? Can my Dynamic action make an AJAX call using java?
    LVL 20

    Expert Comment

    I think some/all of your questions may be answered if you look at the attributes for a PL/SQL page process. In the Conditions section, you have the option of choosing When Button Pressed - where you can pick the button associated with the process. You can also fine tune your process with the Condition Type (in the same section), but neither one of these is required.

    Basically, the process flow is as follows:
    - the process runs according to the path set in the Process Point section (i.e., On Submit - After Computations And Validations/default)
    - at this point, the options are evaluated according to the Conditions section. For example, if your condition type is set to Never, the process will not run.
    LVL 1

    Author Comment

    I have clarified some of my original queries now, but do not quite have a complete understanding of the way buttons work.  

    1. I'm familiar with the 'When Button Pressed' condition on the process page, but I notice that if no button is specified the process still runs (if the page is submitted).

    2. This seems to make sense given that the 'process point' I have specified is 'On Submit...'

    3. In the Button attributes, the Action when clicked can be specified as 'Submit page' but as I have chosen 'Defined by Dynamic Action' the situation is complicated somewhat

    4. In the True action on the Dynamic Action, my java script causes the page to be submitted using this line: apex.submit('SAVE'); But (assuming I do not specify a button name as per point 1) I could as easily have used this command to achieve the same result: apex.submit('XXX');

    5. Whatever other ways the SAVE tag may be used, all I know is that it can be used as a condition on a page process

    6. The Button template uses the information to construct the button:
    <button value="#LABEL#" onclick="#JAVASCRIPT#" class="button-default" type="button" #BUTTON_ATTRIBUTES# id="#BUTTON_ID#">

    Open in new window

    7. Somewhere the button listener is created and the 'onclick' trigger inserted (whatever "void(0)" does).  How this works is still a black box to me. But I think that may be more a Web Development question rather than anything unique to APEX.
    LVL 1

    Author Comment

    Thanks gatorvip again,

    The remaining queries remaining would then be:
    1. I have not specified a DELETE process.  Where can I find the 'Page Process' for:

    Open in new window

    I guess that the 'Database Action' > 'SQL DELETE action' is doing it, but what is being deleted?

    2. are any of these tags (i.e. DELETE, SAVE, CANCEL) reserved words in APEX, meaning that functionality is hard-coded into any button using that Name?

    and, please confirm
    3. if am 'On Submit...' page process  does not specify a button, then any button on the page that submits the form will trigger the page process.
    LVL 20

    Accepted Solution

    1. Among other features, APEX has predefined PL/SQL packages and JavaScript libraries. That's what allows it to call them without explicitly setting a path. In this instance, what you're asking is basically where you can find the JS function apex.confirm, as 'DELETE' is just the request being passed to the function.

    Here is the official documentation (it's for 4.0, but 4.1 will be similar)

    More specifically, the documentation for apex.confirm is here.

    2. Yes and no, you will have to specify an additional database action of SQL Delete (if your button is DELETE). Often, you will need additional functionality that a simple APEX delete/save does not provide. That's when you use your own code, bypassing default APEX functions.

    3. Correct. If you have no restrictions (and really, specifying a button is just a restriction), then the process will always run. The key here is that a button submits the page, while the process runs after Submit.

    Expert Comment

    by:Francis Osei
    What to find out about deletebuttons

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
    Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
    Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
    This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now