Custom Button handling multiple API/URL

  • 0
  • 1
  • Question
  • Updated 11 months ago
  • Answered
  • (Edited)
I'm attempting to update fields when a button is pressed, and this button also runs a report that is a CSV Export. I've tried this both ways, and I either have one or the other run, but I can never have both execute:

If([Type]="Time Sheets",URLEncode(URLRoot() & "db/" &Dbid()&"?a=API_EditRecord&rid="&[Record ID#]&"&_fid_46=1&_fid_64="&ToText(User())&"&_fid_66="&Now()&"&rdr="&URLEncode(URLRoot() & "db/bm38ip98v?a=q&qid=36&nv=1&v0=" & [Batch Info])),"")

Pretty much what I'm trying to do, is Export a CSV based on the current record, and lock that record, which is done by a checkbox, and capture the user and time that export was executed.

I can get either the field updates to work, but there's no csv, or I can get the csv to work, but fields don't update.
Photo of Ryan Stanford

Ryan Stanford

  • 1,560 Points 1k badge 2x thumb

Posted 11 months ago

  • 0
  • 1
Try this syntax. Readability is important to nailing these with fewer syntax errors

var text URLONE = URLRoot() & "db/" &Dbid()
& "?a=API_EditRecord&rid=" & [Record ID#]
& "&_fid_46=1"
& "&_fid_64=" & ToText(User())
& "&_fid_66=" &Now();

var text URLTWO =  URLRoot() & "db/bm38ip98v?a=q&qid=36&nv=1&v0=" & [Batch Info];

& "&rdr=" & URLEncode($URLTWO)