Error code on button

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
So i'm getting this error on a button: <errcode>30</errcode>

This happens when:  I create a new record through a form.  When i push the button, it is supposed to change one of the fields in the record.  Now I understand that the record hasn't "technically" been created yet as I am still in edit mode, but when I push the button it prompts to save first and then proceed.  Why am I still getting the error if it  is supposed to save first?

The button works fine if i go back into the record after saving.  

Is there a way to write some code in the button to save first, then run the command?

THIS IS THE ERROR:
<qdbapi> <action>API_EditRecord</action> <errcode>30</errcode> <errtext>No such record</errtext> <errdetail>Missing "rid" parameter.</errdetail> </qdbapi>
THIS IS MY BUTTON:
URLRoot()& "db/" &Dbid()& "?a=API_EditRecord" &  "&rid=" & [Job Number]& "&apptoken= xxxxxxxxxx"& "&_fid_40=Work In Progress&_fid_102=Sent" &  "&rdr=" &  URLEncode(URLRoot() & "db/" & Dbid())
Photo of Geoffrey

Geoffrey

  • 2,010 Points 2k badge 2x thumb

Posted 3 years ago

  • 0
  • 1
You cannot edit a record with an API if the record dies not exist.

I suggest using a form rule and a checkbox to get a field to change.  You will need to hide your EDIT API button in Add mode, and it's looking to edit the record ID of the record you are in and until the record is saved, there is no record ID.
Photo of Geoffrey

Geoffrey

  • 2,010 Points 2k badge 2x thumb
Is there any way to have a button that saves and redirects to to the same record first.  Then I can use the EditRecord API function on my next button?
Try this crazy looking code in s formula text field with HTML enabled.


"<a class='Vibrant Success' onclick=$('#RedirectURL').val(document.location.href.replace(/&rl=[a-z0-9]*/,''));$('[name=rl]').val('');$('#saveButton').trigger('click'); href='#'>Save & Edit</a>"
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,434 Points 20k badge 2x thumb
Use the Save and Scooby Doo technique:

What is the Save and Scooby Doo Technique?
https://quickbase-community.intuit.com/questions/1298548
If you need help implementing this feel free to contact me off-world using the information in my profile:

https://quickbase-community.intuit.com/users/513
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,434 Points 20k badge 2x thumb
Yeah that's pretty crazy - where did you come up with that?
The same place we all get crazy code - you of course!
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,434 Points 20k badge 2x thumb
You just gave me a great branding idea for Empower 2017:

https://i.imgur.com/sRknRCpg.jpg
Photo of Geoffrey

Geoffrey

  • 2,010 Points 2k badge 2x thumb
This works great.  One thing that irritates me slightly -> The button field name and button name have the same text.  Is there no way of just displaying the button without the field label?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,434 Points 20k badge 2x thumb
You can override the field label by selecting the option "Use Alternate Label Text" in the form builder interface for the field and either leaving it empty or using another text string.