Trying to print after editing record with URL button.

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

Using this URL Button formula

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_12=Arrived"
& "&_fid_120=" & ToText(Now())
& "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxx"
& URLRoot() & "db/" & Dbid() & "?a=printr&dfid=2&rid=" & [Record ID#]
& "&rdr=" & URLEncode(URLRoot()) & "db/" & Dbid()


Getting this error when clicked

<qdbapi>
<action>API_EditRecord</action>
<errcode>0</errcode>
<errtext>No error</errtext>
<rid>942</rid>
<num_fields_changed>2</num_fields_changed><update_id>1443116468954</update_id>
</qdbapi>


Is it possible for URL button print after updating a record? Or am I doing something wrong?

Thanks!
Photo of Justyn

Justyn

  • 20 Points

Posted 4 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
When you do successive actions you need to URLEncode the subseuent ones in a fomat like this



$URLONE

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

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



So you can do


var text URLONE =


URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_12=Arrived"
& "&_fid_120=" & ToText(Now())
& "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxx";




var text URLTWO = URLEncode(URLRoot()) & "db/" & Dbid();

var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=printr&dfid=2&rid=" & [Record ID#];


$URLONE

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

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



I'm not quite sure what that middle one URLTWO is doing, but it might work
Photo of Justyn

Justyn

  • 20 Points
Thanks for the help! Now does all that go into a URL button? Because I'm getting errors "A variable declaration must end with a semi-colon."
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
I would need to see exactly what your formula is (I don't need to see the apptoken.  Like it says, each formula variable needs to end in a semi colon, so there must be a syntax error in one of them.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
So, just to be clear, all this would go in the formula box

var text URLONE =

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_12=Arrived"
& "&_fid_120=" & ToText(Now())
& "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxx";


var text URLTWO = URLEncode(URLRoot()) & "db/" & Dbid();

var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=printr&dfid=2&rid=" & [Record ID#];


$URLONE

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

& URLEncode("&rdr=" & URLEncode($URLTHREE))
Photo of Justyn

Justyn

  • 20 Points
I was missing a semi colon like the error said. Problem now is when I click the button I am taken to a page that says

 There's nothing there...

We can't understand the URL you specified.
If you think the URL is correct, try refreshing this page.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
this middle one was wrong
should be

var text URLTWO = URLRoot()) & "db/" & Dbid();

but like I said, I'm not actually sureb what you want that one to do?

maybe you dont need it and you just want to edit the record and then print it.


var text URLONE =

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_12=Arrived"
& "&_fid_120=" & ToText(Now())
& "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxx";


var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=printr&dfid=2&rid=" & [Record ID#];

$URLONE

& "&rdr=" & URLEncode($URLTWO)
Photo of Justyn

Justyn

  • 20 Points
the urltwo is meant redirect to the dashboard

User log into quickbase and from dashboard can check in RMAs that arrived. When the button is clicked to check in, I want them to remain on the dashboard and not be taken to the record they just modified.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
Oh, OK, then it should work with the three levels and a corrected URLTWO

var text URLTWO = URLRoot()) & "db/" & Dbid();
Photo of Justyn

Justyn

  • 20 Points
I was still getting the "Theres nothing here"
I made a small modification that seems to work however it does not print
I switched urltwo with urlthree

$URLONE

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

& URLEncode("&rdr=" & URLEncode($URLTHREE))
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
Can I see the whole formula please?
Photo of Justyn

Justyn

  • 20 Points
var text URLONE =

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_12=Arrived"
& "&_fid_120=" & ToText(Now())
& "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxx";

var text URLTWO = URLRoot() & "db/" & Dbid();

var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=printr&dfid=2&rid=" & [Record ID#];

$URLONE

& "&rdr=" & URLEncode($URLTHREE)
& URLEncode("&rdr=" & URLEncode($URLTWO))
Photo of Justyn

Justyn

  • 20 Points
Printing does work without URLTWO.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
Can you try changing to this

var text URLONE =

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_12=Arrived"
& "&_fid_120=" & URLEncode(Now())
& "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxx";
Photo of Justyn

Justyn

  • 20 Points
field 120 is a duration field that starts once an RMA is checked in. I'll give it a shot
Photo of Justyn

Justyn

  • 20 Points
Same issue.

But without URLTWO It all works. The record's status is updated to arrived and the timer starts AND I am taken to a print page. What would make this work perfectly is if I could just get the URLTHREE to simply open in a new window. Is that possible?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
I think that the problem is that redirect to the home page as the URL is actually invalid.

When you say this

var text URLTWO = URLRoot()) & "db/" & Dbid();

it will go to a table home page that you are on, but then it does not say what to do.  

Try changing that URLTWO to be hard coded to your Application home page.

like var text URLTWO = urlroot() & "db/aaaabbbbccc12";
Photo of Justyn

Justyn

  • 20 Points
Nope same issue

 There's nothing there...

We can't understand the URL you specified.
If you think the URL is correct, try refreshing this page.

For more information, check out the service page.
Contact support if you need help with this problem.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
Unfortunately I need to get on an airplane soon and I wont be back really in full action until October 5th.  can you post the formula one last time and also post the URL you see in the browser?

Or email it to me directly.  My email address is in my profile.
Photo of Justyn

Justyn

  • 20 Points
Sure no problem

var text URLONE =

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_12=Arrived"
& "&_fid_120=" & URLEncode(Now())
& "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxx";

var text URLTWO = URLRoot() & "db/bj7xkwrqc";

var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=printr&dfid=11&rid=" & [Record ID#];

$URLONE

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

This takes me to
https://watertechcorp.quickbase.com/db/bj7xkwrqc&rdr=https%3A%2F%2Fwatertechcorp.quickbase.com%2Fdb%2Fbj7xkw8xh%3Fa%3Dprintr%26dfid%3D11%26rid%3D877


Have a safe trip
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
The resulting URL does not seem to match with the code we wrote.  Can you do one last thing and that is to remove the Link text for the URL button to expose the code, and post that link?  Failing that I don't mind having a look at it when I am back.  Why dont you contact me offline via the info in my profile.
Photo of Justyn

Justyn

  • 20 Points
Will do, Thanks!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
Well the closest I can come is

var text URLONE =

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#])
& "&_fid_70=Arrived"
& "&_fid_71=" & URLEncode(Now())
& "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxx";

var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=printr&dfid=2&rid=" & [Record ID#];

$URLONE
& "&rdr=" & URLEncode($URLTHREE)

 and then check the box on the field properties to open in new window.  But it does not return to the Home page.  You would need to put a button on the form to go to the home page.