Skip to main content
Question

URL button to populate a field

  • July 26, 2016
  • 0 replies
  • 51 views

Forum|alt.badge.img+7

Can someone look at my formula and tell me why field 138 not populating the word Request when I click the URL button


URLRoot() & "db/" & Dbid() &"?a=er&dfid=12&rid=" & URLEncode ([Record ID#])&"&_fid_138=" &URLEncode ("Request") &"&z=" & Rurl()

This topic has been closed for replies.

  • Registered
  • July 27, 2016
Several Typos and unnecessary URL Encodings. Formatting the formula makes it easier to debug. Try this:

URLRoot() &
"db/" &
DBID() &
"?a=er" &
"&dfid=12" &
"&rid=" & [Record ID#] &
"&_fid_138=Request" &
"&z=" & Rurl()

Actually, I don't believe that the ?a=er operation can populate a field.  It is not a real API call.  

What is it that you are trying to do.  Are you trying to open the record you are on in edit mode and populated a field, leaving the user sitting in edit mode?

Forum|alt.badge.img+7
  • Author
  • Registered
  • July 27, 2016
I am trying to open a related record and populate field 138 with the word request through the URL button

Forum|alt.badge.img+7
  • Author
  • Registered
  • July 27, 2016
It still didn't populate field 138 with Request

  • Registered
  • July 27, 2016
I think Mark is correct here - adding &_fid_138 to the ?a=er URL does nothing. I think you are trying to use  or confusing the behavior of ?a=API_EditRecord or ?a=API_GenAddRecordForm which can take field parameters.

In any event the solution is to use pure JavaScript - formulas will just mess you up.

The a=er won't populate anything. I think it can't be done natively.

Actually, there is a way.

var text URLONE = URLRoot & "db/" & dbid() & "?act=API_EditRecord&rid=" totext([Record ID#]) & "&_fid_138=Request";

var text URLTWO =  and insert your code her for "a=er"

$URLONE
& "&nexturl="  & URLEncode($URLTWO)

Forum|alt.badge.img+7
  • Author
  • Registered
  • August 2, 2016
Now I am getting two error messages
var text URLONE =URLRoot & "db/" & dbid() & "?act=API_EditRecord&rid=" totext([Record ID#]) & "&_fid_9=" &URLEncode([DSAC_SLOT_DATE]);

var text URLTWO =  a=er&dfid=12&rid="

$URLONE
& "&nexturl="  & URLEncode($URLTWO)

First message The argument list of functions URLRoot must begin with a left perenthesis
Second message the variable declaration must end with a semi-colon

Shontay,

The code I posted was not meant to be complete code, but was intended to give you direction.  If you want to get into the world of using APIs in URL formulas, one source of training is an app I have posted to the Exchange called URL Formuals for dummies.

The actual suggested code would be this



var text URLONE = URLRoot() & "db/" & dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#]) & "&_fid_138=Request";

URLRoot() & "db/" & Dbid() &"?a=er&dfid=12&rid=" & URLEncode ([Record ID#])
& "&z=" & Rurl();


$URLONE
& "&nexturl="  & URLEncode($URLTWO)


The first statement should edit the record to put Request into field ID 138.  The second part will then display the record in edit mode.

Going to bump an old thread for anything looking at this in the future for help.

If I understand the logic of this, in the code above, aren't you missing the var statement to assign URLTWO in front of the URLRoot on the 3rd line?

Yes you are correct. It should be

Shontay,

The code I posted was not meant to be complete code, but was intended to give you direction. If you want to get into the world of using APIs in URL formulas, one source of training is an app I have posted to the Exchange called URL Formuals for dummies.

The actual suggested code would be this

var text URLONE = URLRoot() & "db/" & dbid() & "?act=API_EditRecord&rid=" & ToText([Record ID#]) & "&_fid_138=Request";

var text URLTWO = URLRoot() & "db/" & Dbid() &"?a=er&dfid=12&rid=" & URLEncode ([Record ID#])
& "&z=" & Rurl();

$URLONE
& "&nexturl=" & URLEncode($URLTWO)

The first statement should edit the record to put Request into field ID 138. The second part will then display the record in edit mode.