How to time stamp a field using a button.
Hi,
I'm trying to create a form to audit some of our company assets(Keys). I have 3 tables called Keys, Employees and Audits. They are properly related.
When I add a new Audit, I'm able to select the employee I want to audit, then I need to see a list of the assets related to this employee (for this I used a report link from the Keys table and a rich text button called StartAudit to save-and-keep-working in order to see the records on this link report).
In order to register the start-time of the audit, I have a Formula-Time Of Day field in the Audit table called Start Time with the line: ToTimeOfDay([Date Created]). That works just fine.
The problem I'm having is on how to register the End Time of the audit.
After looking into several comments, I tried using another rich text button called Finish Audit that would change the value of the field End Time, then redirect to the same table and same record ID.
This is not working properly since the time that is being registered as End Time is the same as the Start Time.
Here is the formula I used on the Rich Text button (Start Audit):
var text rid = If([Record ID#]>0, ToText([Record ID#]), "%%rid%%");
var text url = URLRoot() & "db/" & Dbid() & "?a=er&rid=" & $rid;
"<a class='Vibrant Primary SaveBeforeNavigating' data-replaceRid=true href='" & $url & "'>Start Audit</a>"
Here is the formula I used on the Rich Text Button (Finish Audit):
var text RID = If([Record ID#] > 0, ToText([Record ID#]), "%%rid%%");
var text Edit = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & $RID & "&apptoken=XXXX&_fid_8="&ToTimeOfDay(Now());
var text DisplayURLMissingRID = URLRoot() & "db/" & Dbid() & "?a=dr&rid=";
var text URL = $Edit & "&rdr=" & URLEncode($DisplayURLMissingRID) & $RID;
"<a class=\"Vibrant Primary SaveBeforeNavigating\" width:310px; text-align: center;\" href='" & $URL & "'>Finish Audit</a>"
Any advise would be greatly appreciated.
------------------------------
Luis Inciarte
------------------------------