Skip to main content
Question

URL button to populate a field with the current user


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);"
This topic has been closed for replies.

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

  • Author
  • Registered
  • October 4, 2018
hmmm..that's what I thought, i tried that but it doesn't put anything into field 30. still blank

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());

  • Author
  • Registered
  • October 4, 2018
correct - the button worked fine when it was [last modified by]

app tokens are enabled.

Does your full formula provide an app token?  Have you posted your full formula?

  • Author
  • Registered
  • October 4, 2018
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);"

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);"




  • Author
  • Registered
  • October 4, 2018
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.

  • Author
  • Registered
  • October 4, 2018
so in the future if my app application tokens need to be turned on then adding this line will suffice?

& "&apptoken=xcxcxcxcxcxcxcxcxcxcxcx"


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!

  • Author
  • Registered
  • October 4, 2018
haha - yes definitely undesrtand that part - thanks :)


Forum|alt.badge.img

Hi everyone - this thread matches what we need but can we still use JavaScript in 2024?  What is the best current option?