Forum Discussion

JeffBell's avatar
JeffBell
Qrew Trainee
7 years ago

Update record upon view

I'm creating a comments table related to tasks in a PM tool. I have a checkbox field for "unread" that defaults to checked. I then have a report that shows all unread comments per user. The comment field is a truncated version of the full comment. I would like to allow the user to click the comment and view the full thing and, when they view it, have the "unread" field update itself to "read." 

Is this possible or some other work around to get it so that the user doesn't need to do anything to update the read status of the comment?

7 Replies

  • Hi Jeff,

    I have actually set something like that up in the past it just requires a little adjustment in several places. Essentially what you can do is create a formula URL button on the Comments table that Tasks are created to that will run an API_EditRecord which marks that field as "Read" and then redirects the user to the Comment. To best make this work you need to go into the report you are basing your report link off and disable the ability to edit and view the record from the report. This way your user only has the option of clicking the View Comments URL button you would create. 

    Once you have the field you would use something like the below formula:

    URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=YourAppTokenHere&rid="&[Record ID#]&"&_fid_field id of status field="& "Read" &  "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])
    This way when your users are on the Tasks table they can see the report link (based on this custom report that has the ability to edit or view a record from the report disabled) and they will click the View Comment button to open it up while the button in the background is marking your comment as read. It will look a bit like my example app below just with your needed fields in place on that report link.

    • JeffBell's avatar
      JeffBell
      Qrew Trainee
      Evan, thank you for that! It was actually quite easy to implement and has now armed me with more tricks like this! I just realized, after doing this, that this will change the record no matter who views it.... Any thoughts on how to go about doing this per user? I want to use this report a bit like a notification area for each user. If more than one person is tagged on the comment, I don't one person 1 marking the comment as read for person 2.
    • EvanMartinez's avatar
      EvanMartinez
      Qrew Elite
      That is a very good question Jeff, that is correct that the button would mark it read by whoever read that comment first. I'm going to have to think on that next level of complexity a bit. 
    • JeffBell's avatar
      JeffBell
      Qrew Trainee
      Evan, I got it figured out. I added a new field to the form called "read by". The field is a user list. Then I modified your button to pass the logged in user rather than a static flag. Then I modified the report to show all comments where the logged in user was notified and was not in the "read" list. Works like a champ!