I have a page where I need to submit and process the page and items(insert and update database) then branch to a certain page depending on which button was pressed. I have 4 buttons and each button should go to a different page, each button also needs to submit the page and process data(using an Apex DML process and passing 'SAVE' request in each button). the problem I'm having is that no matter which button I press the 'app branches to the first branch. I have 4 branches set to run after the process. Each branch should go to a different page depending on the button pressed. In each branch I have made the branch conditional based on the button pressed.
APEX seems to ignore the button condition(in Debug) it says unconditional even though the button is definitely conditional.
I'm running Apex 4.2.2
It seems as though when I pass a Request of 'SAVE' Apex treats all buttons with this request in the same manner?Regardless of which button was pressed?
Any ideas or alternatives?
The DML runs ok. I need to branch depending on which button so:
Button 1 - branch to inventory (condition in branch set to when Button 1 pressed)
Button 2 - branch to sale (condition in branch set to when Button 2 pressed)
Button 3 - branch to delivery (condition in branch set to when Button 3 pressed)
Button 4 - branch to installation (condition in branch set to when Button 4 pressed)
All buttons are set to submit page and send a request of 'SAVE' to fire the DML process then conditional branches are set up so enable the app to branch off depending on what button is pressed. No matter what button I press they all branch to the same page and ignore the conditions in each branch.
Any ideas? Or am I making this too complicated?
Your problem is with setting the request of all the buttons to "SAVE", it will always fire the first branch for all those buttons.
If you edit the DML process you will see the following:
|SAVE, APPLY CHANGES, UPDATE, UPDATE ROW, CHANGE, APPLY, APPLY%CHANGES%, GET_NEXT%, GET_PREV%|
This tells you the request values that will perform an Update DML.
You could have one button be "SAVE", another, "APPLY CHANGES", another "UPDATE", and another "CHANGE". They will all do the update DML for you and then the branches will have different request values to trigger off of.
Another option is to set the request of each button like this:
Button 1 - APPLY_CHANGES_INV
Button 2 - APPLY_CHANGES_SALE
Button 3 - APPLY_CHANGES_DELIV
Button 4 - APPLY_CHANGES_INSTALL
These would satisfy the valid update request value of APPLY%CHANGES%
I didn't knew all your buttons send the same request then it's normal that your different branches mess up, because your processes and branches look at the request your button sends and not at the label of your button. You will need to make sure they each give a different request.