Forum Discussion

DeeDeeTaylor1's avatar
DeeDeeTaylor1
Qrew Member
20 days ago
Solved

API_GenAddRecord then redirect to a report

Hello all! This is my first post in this forum.

I am trying to create a formula URL field that displays as a button on a table report that is filtered by a single date.

This button when executed should add the record, save it and return to the report with the same filters that the user started on.

This is what I have set up:

var text urlone = URLRoot() & "db/" & Dbid() & "?a=API_GenAddRecordForm&_fid_6=" & [Related Placement] & "&_fid_12=" & [Week Ending Date] & "&_fid_504=" & [Job Notes] & "&_fid_505=" & [Placement Notes] & "&apptoken=(my app token)"; 

var text urltwo = URLEncode(URLRoot() & "db/" & Dbid() & "/tablereport?a=q&qid=16&nv=1&v0=" & [Week Ending Date]);

$urlone & $urltwo

This will generate the form with the appropriate field populated, but the user must press the save button on the record to return to the filtered report. 

I have also tried modifying urltwo to 

var text urltwo = "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "/tablereport?a=q&qid=16&nv=1&v0=" & [Week Ending Date]);

but the user must still manually save the record before the filtered reports displays. 

Any idea how I can get the newly generated record to save and redirect to the filtered report in one click??

  • Gen Add record stops on the form to create the new record. API_AddRecord does not. Try this

    var text urlone = URLRoot() & "db/" & Dbid() & "?a=API_AddRecord&_fid_6=" & [Related Placement] & "&_fid_12=" & [Week Ending Date] & "&_fid_504=" & [Job Notes] & "&_fid_505=" & [Placement Notes] & "&apptoken=(my app token)"; 

    var text urltwo = URLEncode(URLRoot() & "db/" & Dbid() & "/tablereport?a=q&qid=16&nv=1&v0=" & [Week Ending Date]);

    $urlone 
    & "&rdr=" & URLEncode($urltwo)

2 Replies

  • Gen Add record stops on the form to create the new record. API_AddRecord does not. Try this

    var text urlone = URLRoot() & "db/" & Dbid() & "?a=API_AddRecord&_fid_6=" & [Related Placement] & "&_fid_12=" & [Week Ending Date] & "&_fid_504=" & [Job Notes] & "&_fid_505=" & [Placement Notes] & "&apptoken=(my app token)"; 

    var text urltwo = URLEncode(URLRoot() & "db/" & Dbid() & "/tablereport?a=q&qid=16&nv=1&v0=" & [Week Ending Date]);

    $urlone 
    & "&rdr=" & URLEncode($urltwo)

    • DeeDeeTaylor1's avatar
      DeeDeeTaylor1
      Qrew Member

      Worked exactly as I needed it to! Thank you so much for the help and the fast response!