Is it possible to define rules that run when adding records through the API?

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

I have an application that is accessed via API (just for adding records), and also by users entering/editing records. I have an add/edit/view form that has rules defined for it to set a Status field based on the value of the Category field. I want the Status field to be set to a specific value only if the Category field has a certain value. This works well if a user enters or edits a record. However, if I call AddRecord through the API, these rules get bypassed, and the Status field doesn't get set properly.

Are there any rules that can be defined to run when the AddRecord API call adds a new record? If not, how might one solve this problem? 

Photo of Wayne

Wayne

  • 0 Points

Posted 4 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 65,634 Points 50k badge 2x thumb
Can you post your API formula?  Is this a formula URL button or are you using script?
Photo of Wayne

Wayne

  • 0 Points
I'm not sure what you mean by an API formula. We post through the AddRecord API call. The only computed part of the equation is a Dynamic Form Rule when adding a new record. These dynamic form rules are what I'd wish were automatically run when a new record is added, either through the API or user entered, but these rules do not run after the API posts the record, which is my issue.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,064 Points 20k badge 2x thumb
If you are using the API to add records you have full control of the field values in whatever language you are making the API calls in. Just write your logic and assignments in that programming language prior to making the API call.
Photo of Wayne

Wayne

  • 0 Points
I understand that this could be set at the time that the API call is made, I want to be able to define/change these rules outside of the client installed base. It makes sense to embed this logic into Quickbase where it can be managed and changed as required. This seems like this is a feature that is lacking that these rules get bypassed via API unless a user physically adds the record.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,064 Points 20k badge 2x thumb
But many of the dynamic rule's actions do not make sense if applied to API calls:

hide, show, display a message, require, unrequire, make read-only, make editable, abort the save