Ingnore Reporting Error 400 on add new record

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • In Progress

I am using Quick Base Actions to add a new record to a child table when a new record is added to the parent. The parent table is  connected to a Drop Box CSV file and the field I am copying is the Key field in the Child Table. The copy is working fine, but when I rerun the Connected table Sync to update the parent table the Action is triggered. When the action try's to add a new record to the Child table it raises the 400 error "cant add duplicate record to Key field".

My question is can the 400 error be ignored and not be reported as a failure. I am still in the testing faze but production will have over 10,000 records that is a lot on error messages

Photo of Eric Turrentine

Eric Turrentine

  • 500 Points 500 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,438 Points 50k badge 2x thumb
I suggest that you put a condition on the Action so it does not try to duplicate a Key field.  I'm not quite sure I understand your setup in terms of duplicating the Key field, but it sounds like you have a 1 for 1 relationship where every parent has exactly 1 child record and you have set the Key field of the Child to be the same as the Record ID# of the Parent.

If that is the case, then you should be able to do a summary field of the # of children, and not fire the Action of the Parent already has it's child record created. 
Photo of Eric Turrentine

Eric Turrentine

  • 500 Points 500 badge 2x thumb

Sounds like we are on the right track I tested the solution but still got the error.

 below is the criteria I added

this is a one to one as you stated The parent is a read only Synced table with 28 fields and the Child has additional fields that needed to be added to the work order table and needed to be editable by the user

Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,904 Points 20k badge 2x thumb
I am not sure what your setup is or what the error a "400" refers to. Is it a HTTP Status code 400?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

I don't see anything close to a "400" error code in the HTTP API:

https://help.quickbase.com/api-guide/index.html#errorcodes.html

If API_AddRecord is generating the error there is a parameter ignoreError you can add to the call:

HTTP API API_AddRecord
https://help.quickbase.com/api-guide/index.html#add_record.html

A screenshot or more details would help understand what is going on.
Photo of Eric Turrentine

Eric Turrentine

  • 500 Points 500 badge 2x thumb

Here is the screen shot of the error

Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,438 Points 50k badge 2x thumb
Before you get into non native solution, I suggest my solution to avoid trying making duplicate Key fields.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,904 Points 20k badge 2x thumb
You could try and add  the parameter ignoreError  to the API_ImportFromCSV call and cross your fingers.  Sometimes there are undocumented parameters on the various API methods. Otherwise you can use script.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,438 Points 50k badge 2x thumb
Eric, your condition is backwards, right. You want to fire when the # of children is 0 not 1
(Edited)
Photo of Eric Turrentine

Eric Turrentine

  • 500 Points 500 badge 2x thumb

That worked

Thanks for you help

Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,438 Points 50k badge 2x thumb
Great, thx for letting me know.
It is actually pretty cool that that works as Quick Base is essentially mass updating and then for each record imported it needs to calculate that summary field to decide if it needs to fire the Action.