Quick Base Discussions

Expand all | Collapse all

URL button to populate a field

  • 1.  URL button to populate a field

    Posted 07-26-2016 19:51

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



  • 2.  RE: URL button to populate a field

    Top
    Contributor
    Posted 07-26-2016 20:02
    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()


  • 3.  RE: URL button to populate a field

    Posted 07-26-2016 20:15
    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?


  • 4.  RE: URL button to populate a field

    Posted 07-26-2016 20:18
    I am trying to open a related record and populate field 138 with the word request through the URL button


  • 5.  RE: URL button to populate a field

    Posted 07-26-2016 20:26
    It still didn't populate field 138 with Request


  • 6.  RE: URL button to populate a field

    Top
    Contributor
    Posted 07-26-2016 20:33
    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.


  • 7.  RE: URL button to populate a field

    Posted 07-26-2016 20:36
    The a=er won't populate anything. I think it can't be done natively.


  • 8.  RE: URL button to populate a field

    Posted 07-26-2016 22:20
    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)


  • 9.  RE: URL button to populate a field

    Posted 08-01-2016 20:53
    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


  • 10.  RE: URL button to populate a field

    Posted 08-02-2016 10:58
    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.


  • 11.  RE: URL button to populate a field

    Posted 08-11-2017 15:15
    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?


  • 12.  RE: URL button to populate a field

    Posted 08-12-2017 01:16
    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.