0

I want to set an item value with a dynamic action located on a button. After displaying a dialog page in the "DialogClose"-Action I do a "SetValue" and "SubmitPage" in the True-branch of the action.

Problem is: the item is set but not submitted. Reloading displays the original value. Have tried the solution showed here, but it didn't solve it for me: Apex 5 : Dynamic action set page item value

Next I was suspecting that the problem is that the region is being set to "read only" on page load. But I tried with the region not being set to read only - problem stayed the same.

Update: double checked on the "read only"-region: it does make a difference. Unsetting "read only" made id work. Seems I was a bit confused while testing ...

Here's how the dynamic action looks like:

Display of the dynamic action

The set-value part looks like this:

Display of the set-value part

And here's the submit action:

Display of the submit action

Any ideas? Thanks!

sers
  • 3,139
  • 3
  • 20
  • 28
  • Why did you select "PL/SQL Expression" for your Set Value type? What makes you think the value isn't submitted? Given your reply to the answer below, it seems you have a form page that's refetching the value from a table. Is that not the case? – Dan McGhan Apr 13 '20 at 18:37
  • Oh, did some experimenting there - set it to "PL/SQL Expression because of what I read there https://stackoverflow.com/questions/29756037/apex-5-dynamic-action-set-page-item-value but that one didn't help. I started of with "static". What makes me think it's not submitted? Because the value on the table is not changing. – sers Apr 13 '20 at 19:41
  • I see. Given your logic, static is fine. As for the submit, your action doesn't specify a Request/Button Name. Try setting that to CREATE or SAVE. – Dan McGhan Apr 13 '20 at 21:16

2 Answers2

0

My first guess is that your item P11_GUT_LIZ has a "Source" attribute with setting "used" at "Always, replacing any existing value in session state"

Screenshot of the "Source" attribute region for page item

If this is not the case, I suggest you add an "After submit" process for debugging in the processing tab, showing you the value after page submit:

raise_application_error (-20001,'The value of P11_GUT_LIZ is: '||: P11_GUT_LIZ);
  • 1
    Interestingly, setting it to any other value than "Always ..." will raise an error as stated in the Docs: "Page items based on a database column where the attribute Source Used is set to Only when current value in session state is null will raise an error when the page item gets rendered. Using this setting for a database column is very dangerous and can result in accidentally overwriting data when viewing and saving multiple records. Always set the Source Used attribute to Always, replacing any existing value in session state." Will try with debugging as you propose next :-) – sers Apr 13 '20 at 10:09
0

As written in the update to the question, problem was that the region was read-only. So the idea of setting a value and submitting it was probably flawed from the beginning. But the region has to stay read-only.

So my solution to circumvent this was to set that value inside of an automomous transaction by calling a pl/sql procedure.

Thanks for all the valueable input!

sers
  • 3,139
  • 3
  • 20
  • 28