Skip to main content
Solved

API_GenAddRecord then redirect to a report

  • May 9, 2024
  • 0 replies
  • 393 views

Forum|alt.badge.img+1

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??

Best answer by MikeTamoush

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)

This topic has been closed for replies.

Forum|alt.badge.img+20
  • Registered
  • Answer
  • May 9, 2024

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)