Discussions

 View Only
Expand all | Collapse all

URL button to populate a field with the current user

  • 1.  URL button to populate a field with the current user

    Posted 10-03-2018 17:52
    Hi There,

    I currently have a url button that populates a certain field with the user that last modified the record.  

    I need some help to change it from the user the last modified the record to the current user that pushes the button.

    is there anyway to modify the below for the above requirement?


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

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


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


  • 2.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:22
    & "&_fid_30=" & URLEncode(User());


  • 3.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:32
    hmmm..that's what I thought, i tried that but it doesn't put anything into field 30. still blank


  • 4.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:35
    Are you saying that the button did work properly for the [Last Modified by].  Do you have application tokens disabled?

    You can also try this, as this is the format I usually use myself for Userid field types.

    & "&_fid_30=" & ToText(User());


  • 5.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:37
    correct - the button worked fine when it was [last modified by]

    app tokens are enabled.


  • 6.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:41
    Does your full formula provide an app token?  Have you posted your full formula?


  • 7.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:42
    here's the full formula

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

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


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


  • 8.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:44
    OK, so there is no way that the formula can work if your app is requiring Application Tokens.  You need to either turn off the need for Application Tokens or else provide on in the formula by adding in a line like,


    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&apptoken=xcxcxcxcxcxcxcxcxcxcxcx"
    & "&_fid_30=" & URLEncode([Last Modified By]);


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





  • 9.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:45
    ah...some reason app token on the home settings on the app was click on.  Thanks for all your help your first solution works just fine now.


  • 10.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:47
    so in the future if my app application tokens need to be turned on then adding this line will suffice?

    & "&apptoken=xcxcxcxcxcxcxcxcxcxcxcx"



  • 11.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 20:56
    Well, yes, that Syntax, but I assume that you realize that you need to go to "Manage Application Tokens" and click the button to create an Application Token for your app to use in URL formuals. 

    ie  "xcxcxcxcxcxcxcxcxcxcxcx"

    will not be the one that works for you!


  • 12.  RE: URL button to populate a field with the current user

    Posted 10-03-2018 21:00
    haha - yes definitely undesrtand that part - thanks :)