Forum Discussion

HowardFu's avatar
HowardFu
Qrew Cadet
6 years ago

API copy a record and change some fields

Hello QB Community,

How do I use API to copy a record in the same table and change a couple of values in the newly created record.

------------------------------
Howard Fu
------------------------------
  • Are you copying a record that is already saved? or would this be like a "Save and New" button?

    ------------------------------
    Ryan Stanford
    ------------------------------
    • HowardFu's avatar
      HowardFu
      Qrew Cadet
      I want to copy an existing record. The new record would have some values the same and some different.

      ------------------------------
      Howard Fu
      ------------------------------
  • Did you want to be sitting on a record and pop up a duplicate of a record in Add mode waiting fir the user to complete certain fields, but with most fields carried forward, it did you actually want to create the record and land the user in the new record?

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • HowardFu's avatar
      HowardFu
      Qrew Cadet
      Hi Mark,

      I want to land the user in a newly created record where they don't have to make any changes.

      ------------------------------
      Howard Fu
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        try this as a URL formula button  I'm just on my iPhone do post back if there are any syntax errors  



        URLRoot() & "db/" & Dbid()

        & "?act=API_AddRecord"
        & "&_fid_6=" & URLEncode ([Purchase Order])

        & "&_fid_17=" & [Qty]
        & "&_fid_10=" & [Related Priced Material]

        & "disprec=1"

        for each field ID you need a new line for your own sanity. 



        if the data being put into the field might have text with spaces of special characters, you need to URLEncode as above. 

        if here are fields of type User or date they need to converted to text

        Like

        & "&_fid_17=" & ToText(User field])

        the last line says to display the record after the click. 



        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------