Forum Discussion

ChrisMacFarlane's avatar
ChrisMacFarlane
Qrew Trainee
8 years ago

Problem with UserToken in Formula URL

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);
  • MichaelGraham2's avatar
    MichaelGraham2
    Qrew Assistant Captain
    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);
  • 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);
  • great thank you.  That worked (for the button), but it still didn't fix the problem with the Quickbase action
  • 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.
  • 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
  • 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. 
  • Same as the QB support tech I spoke with.  I think he was taking shots in the dark to try and resolve it.  
  • JasonJohnson's avatar
    JasonJohnson
    Qrew Assistant Captain
    what is the trigger field and more importantly what field types are you populating?