Forum Discussion

DwightMunson1's avatar
DwightMunson1
Qrew Assistant Captain
8 years ago

Formula URL button to display a user list and add that user to a field.

I'm creating a button on a report for one of our team leads. The report will show the drafting status of permits. I want him to be able to click a button that will display a list of users, and assign that user to a field. 

So far I've gotten to the ability for a drafter to click a button to assign a project to themselves:

URLRoot(Company URL) & "db/" & dbid() & "?a=API_EditRecord&rid="&[Record ID#]&"&apptoken=myapptoken&_fid_216=User()

I'm trying to do this without the use of java, but I will resort to that if needed. I haven't seen any java work since high school. Does Quickbase automatically come with the ability to use javascript? 

Thanks in advance/ 
  • Can you explain where you are stuck?   What is not working.  Is the issue that it does the update correctly but spews an XML success message on the scree which is not user friendly.

    If that is the only problem,you can use this format.

    var text URL = URLRoot(Company URL) & "db/" & dbid() & "?a=API_EditRecord&rid="&[Record ID#]&"&apptoken=myapptoken&_fid_216=User();

    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);
  • DwightMunson1's avatar
    DwightMunson1
    Qrew Assistant Captain
    There was that, so thank you very much.
    Where I'm stuck is that I can only supply the field with the current user's ID. I want to be able to select the user from a popup list, like you would if you were on the form filling in the actual field. That way the team lead can easily assign work to drafters.
  • DwightMunson1's avatar
    DwightMunson1
    Qrew Assistant Captain
    Also, 
    This is what I actually have in there now, and it seems to not be filling in the field and I can't figure out why. I seem to have all the necessary elements in there with no error messages. 

    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_216=" & URLEncode(UserToName(User())) & "&apptoken=MyActualAppToken";

    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);
  • Let's go back to basics.

    Plan A.  Skip the whole URL formula thing and have the user simply select a user manually in edit mode on the record.  There would be a drop down list of all users with access to the app.

    Plan B.

    Make a table of Users.  Set the Key field to be the User field.  Make a relationship where 1 User has Many Records.    Then the drop down list will be limited to the users in that table.
  • DwightMunson1's avatar
    DwightMunson1
    Qrew Assistant Captain
    I like your plan b, thank you. 
    Also, I figured out why the field wouldn't populate. I don't need User To Name since it is a user field.