Forum Discussion

ElenaLarrabee1's avatar
ElenaLarrabee1
Qrew Captain
8 months ago

ifv not working with API_AddRecord?

Hey all, has anyone else encountered this? I'm using a rich text button to (among other things) add and display a new record in one fell swoop. However, I cannot get it to respect my &ifv=10 settings, it's still pulling up the new record in a form with full QB branding and navigation. 

var text NewTimeSheet = URLRoot() & "db/" & [_DBID_CREW_TIME_RECORDS] & "?act=API_AddRecord"
& "&apptoken=XXXXXX"
& "&_fid_37=" & [Record ID#]
& "&ifv=10"
& "&disprec=1"
;

#APIsandcustomcode #api_addrecord 



------------------------------
Elena Larrabee
------------------------------

5 Replies

  • Without seeing the full formula, I think what you may be looking for is:

    ?a=nwr in place of where you have ?act=API_AddRecord

    The API_AddRecord happens behind the scenes and requires a redirect to say what to display after the new record is created. However, since the record isn't created at the time the button is pressed there is no way to capture the new record's ID to display it in the the redirect. There are some ways of doing this, but they are quite complex.

    Using nwr (or API_GenAddRecordForm) simply passes the values you want to a new record but the user is responsible for saving it. This means you will still need a custom save button on your form when using the ifv=10.

    I teach both APIs and Rich Text buttons in the Quick Base Junkie Button Bundle if you want to learn more.

    -Sharon



    ------------------------------
    Quick Base Junkie
    Sharon Faust
    https://quickbasejunkie.com
    ------------------------------
    • ElenaLarrabee1's avatar
      ElenaLarrabee1
      Qrew Captain

      Thanks Sharon! Unfortunately, I have to have the record fully created before the user lands on the record form for the next step in the process, because there is a button on the next step that has to pass along the RID to a record in another table. I was trying to avoid having to use Javascript to pull the RID on the second button in the series....



      ------------------------------
      Elena Larrabee
      ------------------------------
      • ChayceDuncan's avatar
        ChayceDuncan
        Qrew Captain

        Sounds like you'll need to either 1) use some kind of code page injection to create the record and then redirect the user to the new RID or 2) consider using some kind of save and continue button if possible. 

        With the code page you would just create the record and get the RID from the response and redirect the user to the new record. If its available though - you could try and convert your button over to a GenAddRecordForm and instruct the user with a 'Save & Continue' type process where it saves the record and keeps them on their new form with the next step in the workflow unlocked now that the RID has been committed. Either one should allow you to continue with the IFV in place since you would be in control of the redirect. 



        ------------------------------
        Chayce Duncan
        ------------------------------