Forum Discussion

MattHolmen's avatar
MattHolmen
Qrew Member
3 years ago

Pre fill values when editing(not adding) a record.

I have a list of VendorXref records associated with my Contract table.  I also have a relationship between my Vendor and Contract tables directly.

What I am trying to do is click the button below, to then update the Contract table with the 1 specific vendors Record Id.  There is other info that also needs to be filled in so I can't just make it a checkbox.


This is where the button takes you, I want the Vendor to be filled in, then I could make it read-only.  My link works on a New Record, but not for an edit record.  Is it possible, thoughts?  Thanks

URL: https://xxxxxxx.quickbase.com/db/bruvtb6ne?a=er&dfid=14&rid=90&_fid_34=43



------------------------------
Matt Holmen
------------------------------

1 Reply

  • Have you tried using the EditRecord API?

    Assuming the current contract record is already saved, you can use a formula query to retrieve the maximum record id of the contract table and insert it into the url like so:
    var textlist listOfRids = GetFieldValues(GetRecords("{3.GTE.'1'}", "contract tableid"),3); - this query retrieves all contract record ids
    var number listSize = Size($listOfRids); - this gets the size of the list
    var text maxRid = Part(ToText($listOfRids), $listSize, ";"); - this captures the last record in the list, which is the max
    var number rid = ToNumber($maxRid); - this converts it to a numeric value

    Then,

    URLRoot() & "db/" & contract tableid & "?a=API_EditRecord&rid=" & $rid & "&_fid_34=" & [Record ID#] & "&rdr=" & URLEncode(URL to land on after editing the record, otherwise you'll just see an xml response)

    ------------------------------
    Ahuva Brown
    ------------------------------