Skip to main content
Question

Home page URL in Button bar to autocreate record in a table

  • May 30, 2019
  • 0 replies
  • 147 views

Hi,

I am trying to create a URL button in a home page button bar that will automatically create a record in a table. I found a post here saying to create it first in a formula field and remove the label to expose the link address to paste as the URL.

I did this and works greats as a formula field, but when using the link address on a homepage button I get the error. "Trying to add a non-unique value to a field marked unique. The field named "my_field" with field id XXX requires a unique value." What confuses me is that this field is not within or associated in anyway with the table_ID in which the record gets created.

Can anyone assist with this or explain why this is preventing a record from being created?

Formula field:
var text URL = URLRoot() & "db/" & [_DBID_MY_TABLE_ID] & "?a=API_AddRecord";
"javascript:" &
"$.get('" & 
$URL & 
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);"

URL link address on homepage:
javascript:$.get('https://(company).quickbase.com/db/(MYTABLEID)?a=API_AddRecord',function(){location.reload(true);});void(0);
This topic has been closed for replies.

Are you trying to actually add a record, or just put up an add record form.  If you are trying to actually add a record, are there any fields you need filled in or did you want to, for some reason, create a blank record.  And furthermore, after a record is added, where did you want to land the user?

If you are just trying to put up a button to open a form to add a record, then there is native functionality for that when you make a Dashboard button, no need for any code.


  • Author
  • Registered
  • May 30, 2019
Thanks for a quick reply and yes this would just add a blank record, as crazy as it may sound, so I'm trying to make it as simple as possible for my users.
Also, I'd like to just return the user back to the home page, which I believe the javascript will do fine.

Appreciate the feedback.

Forum|alt.badge.img+12
OK, so I tried this and got a message that I could not embed Javascript into a URL button on a Home Page.  So I did this and it works.