Forum Discussion

JackWoods's avatar
JackWoods
Qrew Trainee
4 years ago

Update Date & Time field with URL Button

Hey Community,

I'm working on some cool approval functionality and want to be able to use a URL button field to 1, change the status and 2, update the date and time of a field. 

I have everything worked out excepted for the date and time stamp of "today" or "now"

& "fid_67="Today()" 

what's is the proper formula to update this field to the current date and time? 

Let me know if you need any additional information. Thank you :)

------------------------------
Jack Woods
------------------------------

3 Replies

  • If it's  date time field

    & "fid_67=now"

    It's an "easter egg" undocumented secret that will give the current date/ time when clicked even if the browser has been sitting "stale" for a long time.

    This Syntax
    & "fid_67=" & urlencode(Now())

    will load the current date/ time into the button as the time the screen is loaded,  but that will get stale if the screen sits for a while.

     

     


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • JackWoods's avatar
      JackWoods
      Qrew Trainee
      The now seem to work but I'm getting an error message when the button is pressed now. 

      "This XML file does not appear to have any style information associated with it. The document tree is shown below.
      <qdbapi>
      <action>API_EditRecord</action>
      <errcode>0</errcode>
      <errtext>No error</errtext>
      <rid>2</rid>
      <num_fields_changed>0</num_fields_changed>
      <update_id>1611595484356</update_id>
      </qdbapi>"




      HERE IS THE FOMRULA FOR THE BUTTON: 

      "javascript:if(confirm ('Are You Sure You Want To Approve This?')){location.assign('/db/" & Dbid()
      & "?act=API_EditRecord&apptoken=cppcatecu6khbiyb25chbxtangb"
      & "&rid=" & [Record ID#]
      & "&_fid_7=Approved"
      & "fid_67=now"
      & "&rdr=" & URLEncode(URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]))

      &"')}"

      ------------------------------
      Jack Woods
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        It's not an error message, just an unfriendly success message.  I'm not an expert on that syntax with the popup confirm, but I do have this alternate code that you can try.

        var text URL= URLRoot() & "db/" & Dbid() & "?act=API_DeleteRecord&rid=" & [Record ID#]
        & "&apptoken= xxxxxxx";

        "javascript: " &
        "if ( confirm('Are you sure you want to permanently delete this record ? ') == true ){ "&
        "$.get('" &
        $URL &
        "',function(){" &
        "location.reload(true);" &
        "});"
        & "void(0);"&
        "}"


        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------