Problem with UserToken in Formula URL

  • 0
  • 1
  • Question
  • Updated 7 months ago
  • In Progress
I have a working Formula URL button which is changing the value in a checkbox, based on the current value.  However, we're having problems with another user's use of the button to trigger a quickbase action (the related records won't update).  Through some discussion with Quickbase support, they believe that I need to add a user token to the formula.  I have the user token created, but I'm not sure how to add it to the formula URL.  This is the current formula:

// make a formula variable to be the opposite of the checkbox condition.
var bool NewValue = not [Process for Submission] ;


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

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

Chris MacFarlane

  • 202 Points 100 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Would it not be the apptoken instead??  Something like this ??

URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_9=" &apptoken=apptoken& URLEncode($NewValue);
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,348 Points 50k badge 2x thumb
Try this

// make a formula variable to be the opposite of the checkbox condition.
var bool NewValue = not [Process for Submission] ;


var text URL =
URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_9=" & URLEncode($NewValue)
& "&usertoken=xxxxxxxxxxxxxxxxxxxx";

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

Chris MacFarlane

  • 202 Points 100 badge 2x thumb
great thank you.  That worked (for the button), but it still didn't fix the problem with the Quickbase action
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,348 Points 50k badge 2x thumb
The Quick Base Action should continue to operate under the Permission of the user who created the action.

I suggest that you check if the "other User" actually has permission to update that record.

 One way to do that is to change the URL button to this - ie temporarily comment out the javascript refresh as that hides the error messages.




// make a formula variable to be the opposite of the checkbox condition.
var bool NewValue = not [Process for Submission] ;


var text URL =
URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_9=" & URLEncode($NewValue)
& "&usertoken=xxxxxxxxxxxxxxxxxxxx";

$URL

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



That will expose any error messages when the button is pushed.  My guess is that the "other user will push the button and get some kind of permissions error.
Photo of Chris MacFarlane

Chris MacFarlane

  • 202 Points 100 badge 2x thumb
I know that the users have permission to update both records.  The actual records in the other table would already have been updated by these users (and they have), and the checkbox value is changing when the user clicks the button, so I believe the permissions are okay.  I also just tried changing the users role to Administrator (same as my role) in the most recent test and the results are the same.  I'll comment out based on your suggestion and report back
Photo of Chris MacFarlane

Chris MacFarlane

  • 202 Points 100 badge 2x thumb
No errors on the update (and that's validated because the checkbox value always changes), it's just that with this user the QB Action doesn't fire. 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,348 Points 50k badge 2x thumb
Well that has me stumped.
Photo of Chris MacFarlane

Chris MacFarlane

  • 202 Points 100 badge 2x thumb
Same as the QB support tech I spoke with.  I think he was taking shots in the dark to try and resolve it.  
Photo of Jason

Jason

  • 1,406 Points 1k badge 2x thumb
what is the trigger field and more importantly what field types are you populating?