Using API_DoQuery in API_EditRecord

  • 0
  • 1
  • Question
  • Updated 6 months ago
  • Answered
I'm trying to create a webhook that will edit the record in another table when a new record is added. To do so, I'm trying to use a field in the new record to search the records in the other table for matching values, and then edit those results accordingly.

Here are the details of the webhook I've created:
Endpoint URL:  https://fedex.quickbase.com/db/<b>[Insert DbID]<br></b>HTTP Method: POST
Message Format: XML
Message Header: QuickBase-Action     API_EditRecord
Message Body:
<qdbapi>
<usertoken>[Insert User Token]</usertoken>
<key><query>{'45'.CT.'[District]'}</query></key>
<field fid="22">[Start Date]</field>
<field fid="23">[Month]</field>
<field fid="25">[Fiscal Year]</field>
</qdbapi>

Essentially I'm trying to find the record for a the district that just received an audit (new record) and update specific fields in that record. However, I keep getting an error code of 30 (no such record). Below is the error code response:

<?xml version="1.0" ?>
<qdbapi>
<action>API_EditRecord</action>
<errcode>30</errcode>
<errtext>No such record</errtext>
<errdetail>Sorry, there is no record in this application table with the record identifier (rid)  of &quot;4294967295&quot;.</errdetail>
</qdbapi>

The reference guide for API_EditRecord indicates that you can use API_DoQuery I'm just not sure what I'm doing wrong.
Photo of Daniel Newhart

Daniel Newhart

  • 90 Points 75 badge 2x thumb

Posted 6 months ago

  • 0
  • 1
Photo of Evan Martinez

Evan Martinez, Community Manager

  • 8,754 Points 5k badge 2x thumb
Hi Daniel,

Are your Districts and Audits related via a table to table relationship? If so you should have a Related District field that will store the key field value (typically Record ID#) from the parent table, that you can use to help target your webhook. That would allow you to remove the need for a DoQuery. 
Photo of Daniel Newhart

Daniel Newhart

  • 90 Points 75 badge 2x thumb
I tried relating them (District as parent and Audit as child) and creating a QuickBase Action, but it would not allow me to edit related records. I'm guessing that was due to the direction of the relationship, but I could probably just do an EditRecord webhook instead using the Record ID#. I think I was trying to make this too complicated, I'll give that a shot and reply with the results.
Photo of Evan Martinez

Evan Martinez, Community Manager

  • 8,754 Points 5k badge 2x thumb
Hi Daniel,

That does happen at times by default for Actions, they can be set to trigger on a child record and change a parent record it just takes a few more steps. On the child table you just need to create a report link field that matches the Related Parent field to the Key field in the parent table. Then you can use that as the target for your Action. It just won't display that option as available till the child table has a report link on it since those report links serve to help the Action target the right records to change. 
Photo of Daniel Newhart

Daniel Newhart

  • 90 Points 75 badge 2x thumb
I tried out both ways and got both to work. I decided to keep the the action and get delete the webhook. Thanks for the help!
Photo of Evan Martinez

Evan Martinez, Community Manager

  • 8,754 Points 5k badge 2x thumb
Excellent I'm glad I was able to help.