This is the line which edits the record to update that log field.
var text Log = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_99=Viewed"; // replace 99 with the logged field with logging the time enabled..
If you make a child table to the main table with the file on it, you can populate the field for Related Knowledge Hub record.
so you can change that line to just this.
var text Log = URLRoot() & "db/" & Dbid() & "?act=API_AddRecord"
& "&_fid_10=" & [Record ID#]
& "&apptoken=xxxxxxxxxxxxx";
Normally when adding a child record you would also populate specific fields. But in this case the record owner will be the person who pushed the button and of course the date created will be the date and time that the record was created. So the only field that we need to update is the field for related Knowledge hub record. so you would replace the 10 with the field ID for that field. Since the value we want to populate into that field for Related Parent is of course the Record ID of the Parent then we just put the Record ID into that field because we are in fact launching the button off the parent record.
And yes you are correct that I neglected to mention that if you have left the need for application tokens enabled then you do need to provide the application token when you are adding or editing records. ------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.commark.shnier@gmail.com
------------------------------