Skip to main content
Question

URL button change status

  • July 26, 2018
  • 0 replies
  • 134 views

I've created a buttong to change my status to complete.  What am have I done wrong?

I'm getting this error using this:
 

var text URLONE = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" &[Status]

& "&_fid_12=" & URLEncode("Completed"); 

var text URLTWO=URLRoot() & "db/"&Dbid()&"?a=dr&rid="&[Status];

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


This is the Error: 

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<qdbapi>
<action>API_EditRecord</action>
<errcode>24</errcode>
<errtext>Invalid Application Token</errtext>
<errdetail>An Application Token must be supplied.</errdetail>
</qdbapi>
This topic has been closed for replies.

There are two separate issues.

If you have chosen to require Application Tokens, that is a setting in the Advanced properties settings for the app.  I suggest just disabling the need for them by unchecking boxing that requirement.

If you read up on the Help text for application tokens  and decide that do want to use them, then you will need to add a line of code
& "&apptoken=xxxxxxxxxx"

For you actual code, you need to specify the Record ID# that you want to edit and display.


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

& "&_fid_12=" & URLEncode("Completed"); 

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

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



  • Author
  • Quickbase Alumni
  • July 27, 2018
Thanks so much that did it! 

  • Author
  • Quickbase Alumni
  • July 27, 2018
actually one more question:

I've added he button to a report as well.  seems like when you click the button on the report it the page directs you to the specific record.  Is there anyway for it to just stay on the report and not direct you to the into that specific record?

try this

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

& "&_fid_12=" & URLEncode("Completed"); 



"javascript:" &
"$.get('" & 
$URL & 
"',function(){" &
"location.reload(true);" &
"});"


 note that I renamed that first formula variable.  We no longer use the second formula variable.

  • Author
  • Quickbase Alumni
  • July 27, 2018
This is fantastic - thanks so much for your help, works great.

  • Author
  • Quickbase Alumni
  • July 30, 2018
I've now revised this to update a field with the User ID of the individual that pushes the button and it seems to be working just fine with the below.  However, was wondering if anybody had any suggestions to change this us so that it only displays the user name.  Currently is showing their email address:

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

& "&_fid_18=" & URLEncode([Last Modified By]);



"javascript:" &
"$.get('" & 
$URL & 
"',function(){" &
"location.reload(true);" &
"});"

There is a function called

UserToName([my user field])

Or you can also change the field properties of the user field to display the full name

  • Author
  • Quickbase Alumni
  • July 31, 2018
thank you!