Menu

Set username and datetime with one Action Button

0 votes

How can I have a single Action Button set values on multiple fields?
I have a table functioning as a log for inter-department requests. When a request is submitted (i.e. record is created), I can use audit values in dbFront and/or default values in the database to log who created the record and when it was created. But when the request is completed, I would like there to be an Action Button that records the username of whoever completed it and the time it was completed.
I assume I can use a stored procedure to set multiple values, but how can I pass through the %username% value?

in How To by (660 points)

1 Answer

0 votes

You have multiple options.

1. Access the Audit Values with any Action Button

dbFront will save field changes including Audit Value fields to the database before any action button is called. This means that you can use any appropriate action button type and you will also have access to the appropriate audit values.

The record save and the action button will run within the same transaction so everything is rolled back if there is an error.

2. Pass the %username% directly into the procedure

dbFront will allow you to pass the %username% value directly to the procedure as one of the parameters.

by (46.9k points)
edited by
Thanks Anthony. Just to be sure I understand: It sounds like you're saying I will have to use Run Procedure button type either way. There's no way to set multiple values with a Set Value type. My options are, 1. set username as a dbFront audit value and use the procedure only to set the date, OR 2. pass on the username value and have the procedure record both username and date. Is that correct?
I updated the answer to answer that this applies to all action buttons.
Welcome to the dbFront Q&A site, where you can ask questions and receive answers from other members of the community.
 | Minimalist Answer Theme by Digitizor Media
 |
Powered by Question2Answer
...