Forum Discussion

Roy-Wanyoike's avatar
Roy-Wanyoike
Qrew Captain
3 hours ago

Using one field to collect data multiple times.

In quickbase, I have a field for user and datetime. There are several project status like pending, submitted, review,approved and denied. 
Everytime in the status field change I want to record who did the change and date time. I want to use the two buttons. submitted by and submitted datetime field to track the audit history or logs. I did try with a pipeline but there is no data being recorded. Anyone done this before?

6 Replies

  • Below is the rich text field for the Phase 1 Approved button.  The others follow a similar pattern.  In the updateStatus variable, the status field for the phase is set to Approved (fid = 26) and the status log field is set to Approved (fid = 35). Updating the status log field writes to the history of that field (including user and datetime of approval).

    var bool isApproved = [Phase 1 Status] = "Approved";
    var bool canEdit = (ToText(UserRoles("Name")) = "Administrator" or ToText(UserRoles("Name")) = "Scholarly Activity Reviewer") and [Phase] = [Scholarly Activity Tracker Phase 1];
    var text buttonColor = If($isApproved, "#ffffff", "#6BBD57");
    var text textColor = If($isApproved, "#6BBD57", "#ffffff");
    var text readOnlyColor = "#A9A9A9";
    
    var date curDate = Today();
    var text status = "Approved";
        
    var text newPhase = Case([Type], "Presentation", "Conference Approval", 
    "Manuscript", "REI Review", 
    "Other", "Final Updates"
    , "");
    
    var text updateStatus = "<a class='Vibrant Primary' style=\"width:150px; text-align: center;background: " & $buttonColor & "; border-color: " & $buttonColor & "\" href='" & URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=APPTOKEN&_fid_17=" & $newPhase &"&_fid_26=" & $status & "&_fid_35=" & $status & "&_fid_54=" & $curDate & "&_fid_136=" & $curDate & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#]) & "'>Approved</a>";
    
    var text retainStatus = "<a title='Current status is Approved' class='Vibrant'   style=\"width:150px; text-align: center; color: #6BBD57; background: "  & $buttonColor & "; border-color: " & $buttonColor &  ";\"><b>APPROVED</a>";
    
    var text readOnly = "<a class='Vibrant Primary'   style=\"width:150px; text-align: center; color: #000cad; background: "  & $readOnlyColor & "; border-color: " & $readOnlyColor &  ";\"><i>Approved</a>";
    
    If($canEdit and $isapproved = false, $updateStatus, If($isapproved, $retainStatus, $readOnly))

     

  • Not sure if this will help you.  I have a form with multiple approvals for different phases.  Each approval has its own log field.  A user can click a button to Approve/Reject/Put in Review.  The button writes the user making the change with the datetime of the change to the corresponding log field.

    We have one status that is updated via a pipeline that logs the change (Conference Approval in screenshot).

    The buttons are rich text that call API_EditRecord to update the log field.

  • The usual way to do this is to build a table which will be a child table to the table trying to track.

    The pipeline triggers when certain fields are modified on the main table, and you create a new record with a pipeline, remembering to connect to the main table by populating related parent. There is syntax in a pipeline to record both the current value of the field, and the previous value of the field.

    Would I like to do is to keep the Audit Table very simple and I have a field for the name of the field that was being changed and the old value and the new value.  Of course there will be many entries where the old value and the new value is the same depending on how many fields you are trying to track.  I filter those off the child Table reports and set up a pipeline to delete those records each night.

    • Roy-Wanyoike's avatar
      Roy-Wanyoike
      Qrew Captain

      Before building another table is it not possible to listen when the status changes and records the current user and date of submission.

      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        Yes, that is easily done. You trigger the pipeline when the status field changes and copy the value of [Last Modified By] into your tracking field as to who made the last change.   You can use the Jinja expression. {{time.now}} to populate the date field or else use the [Date Modified] field to populate your Date/Time of the change field.