Forum Discussion

IvanPinney's avatar
IvanPinney
Qrew Trainee
5 years ago

Looking to Create a ""Snooze"" Button by Copying Todays Date to Field

We have a list of reports we are viewing based that populate based on a variety of dates.  

I would like to create a button that copies today's date to another field named "snooze date" on that record, then add a filter in the report to only view records where "snooze date" > 30 days in the past.  

Ultimately I'm trying to create a "Snooze" type button that will filter the record from the reports until ~30 days after the "snooze date".  Any tips/code/references please let me know. 

I have found a number of different sample codes on the forum, however, can't get anything to work.  

Thanks, 

Ivan 

4 Replies

  • here is an example of a butotn called Snooze

    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_1696=" & ToText(Today());

    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);"
  • Thanks Mark, 

    I've dropped it in, The button clicks and submits, and appears to be working, however, the Date is not showing up in the new field?  Any Pointers here?  

    I created a URL - Formula and Dropped in the Above Code.  

    I changed it to, Field ID to 445 to Match the Field "Snooze Date" which is a Text Field 

    Code Below: 
    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_445=" & ToText(Today());

    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);"
  • right, so to debug these, you comment out the javascript stuff and just end the formula with 

    $URL

    That will run the URL and expose the error message.

    99.99% sure the problem is that you either need to go to your Application Properties page and disable the need for Application tokens or else create an application token and supply it like


    ar text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & '&apptoken= xcxcxcxcxcxcxcxxcxccx"
    & "&_fid_445=" & ToText(Today());


    then the javascript refresh stuff.



    • IvanPinney's avatar
      IvanPinney
      Qrew Trainee
      Thanks Mark! got it working, just needed to add in the Apptoken!