Button that edits a record and returns user to same report.

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

I have a button in a report that when clicked edits a record and returns user to the same report. I can do this by using ?a=q&qid=82 as part of my formula.

I want to be able to use this button in multiple reports, not just in the one with qid=82, so my question is this:

Is it possible to make the qid value (82 above) dynamic, so that the user is returned to whichever report they were in when they clicked that button? Or is the only option to hard code the qid and create a different button for each report in which I intend to use this functionality?

Thanks in advance.

Photo of Juan

Juan

  • 74 Points

Posted 5 years ago

  • 0
  • 1
I believe this will work as long as there is no "redirects" in the URL. It should refresh a record or a report, ie it refreshes your page. In this example I am updating a field to the date time of now(). Keep the URL in a separate formula variable or even better, perhaps, have the URL in a separate field so that you can test it on a stand alone basis, and then just assign that field into the generic URL text variable in this formula below. That way your formula below is always standard. The syntax with the various single and double quotes and crazy brackets is tricky. So best not to mess with that!




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


// or alternatively


// var text URL = [some other URL formula field that you have tested which does your edits];


"javascript:" &
"$.get('" &
$URL &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);"
Photo of M

M

  • 80 Points 75 badge 2x thumb
Mark, you are awesome!
Photo of Joel

Joel

  • 0 Points
agreed! Thanks for posting this.  I was ready to give up on it.