Question

Custom Field with #USER_ID# as the Context Substitution Variable

  • 18 January 2023
  • 4 replies
  • 273 views

Badge +2

I have created a custom page with page type ‘Table Window’.  One of the fields is Entered_By using the context substitution variable of #USER_ID#.  When a record is duplicated, the value in Entered_By is copied from the duplicated record instead of populating with the user id of who is adding the record.  Is there any way around this issue?


4 replies

Userlevel 5
Badge +9

Hi, how or where did you set up the value by default with #USER_ID# ?

Userlevel 7
Badge +31

Hi @cbilodeau,

I do not think there is a way around this. This is how duplicate function normally works. It will try to copy all the values from the duplicating record. The user would have to manually change any of the values as necessary before saving the record.

Hope this helps!

Userlevel 5
Badge +9

I think it is possible if you create an event that runs in the background because it will force recalculating the value every time you insert a new line.

There is an article on this subject if you understand a bit PL/SQL:

https://dsj23.me/2021/08/27/tips-to-avoid-mutating-table-error-in-ifs-event-actions/

Badge +2

When creating the custom field, there is an option on the Properties to select a default value; I used the Context Substitution Variable to select #USER_ID#.

Unfortunately, the custom field is set to Read Only so that a new record can’t be entered with someone else’s user id.

I’ll take a look at the article for future reference.  For this instance, I set up an event action that will not allow saving the record if the user adding the record is not the user in the custom field.  If so, they are instructed via the event action to manually enter the record instead of duplicating.

Reply