add new record via url

  • 0
  • 1
  • Question
  • Updated 6 years ago
  • Answered
Hello, I am stuck with the following:

URLRoot() & "db/" & [_DBID_CLAIMS_AND_CORRESPONDENCE]=API_GenAddRecordForm"&_fld_6=" & (ToText([Related Client])) & "&_fld_7=" & URLEncode([Client Name]) & "&_fld_8=" &(ToText([Related Location])) & "&_fld_11=" &(ToText([Related Claim]))

Quickbase is returning the following error message "The argument list of the function API must begin with a left parenthesis." But I don't see where the left parenthesis needs to be. Also not sure about the quotes around "&_fld_6=", are they in the right place?

Thanks!
Photo of Robert

Robert

  • 210 Points 100 badge 2x thumb

Posted 6 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,184 Points 20k badge 2x thumb
You are missing the "act=" part:

?act=API_GenAddRecordForm

Also you don't need the front part:

URLRoot() & "db/" &
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 4,414 Points 4k badge 2x thumb
Are your FIDs 6,8 and 11 numeric reference fields or text reference fields?
Photo of Robert

Robert

  • 210 Points 100 badge 2x thumb
They are numeric reference fields.  Further by removing the URLRoot()... as suggested below I get nothing.  Thanks!
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 4,414 Points 4k badge 2x thumb
Don't convert your reference fields to text - leave them as they are... and you will need the URLRoot().. it doesn't work without it.

"&_fld_6=" & & URLEncode([Related Client]) & "&_fld_7=" & URLEncode([Client Name]) & "&_fld_8=" & URLEncode([Related Location]) & "&_fld_11=" &URLEncode([Related Claim])
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 4,414 Points 4k badge 2x thumb
Dan - unfortunately without "URLRoot() & "db/" &", these formula's do not work.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,184 Points 20k badge 2x thumb
I don't believe you need the front part:

URLRoot() & "db/" &

All this does is create an absolute URL when your browser will automatically resolve the relative URL generated without the front part..
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,184 Points 20k badge 2x thumb
I don't believe this is true. Clear the other errors first and the formula will work without. Web sites are generally constructed using relative URLs for hyperlinks within the same domain. This is true for QuicKBase as well although a tradition has grow up in the QuickBase user community to construct absolute URLs. Always use relative URLs for links within QuicKBase.
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 4,414 Points 4k badge 2x thumb
Dan - have you tried your method with a working formula like this?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,184 Points 20k badge 2x thumb
I haven't tried that formula without the prefix but I never use:

URLRoot() & "db/" &

The base URL of a QuickBase application is:

https://your_subdomain.quickbase.com/db/

Every internal hyperlink within a QuickBase application is resolved against this base URL. FWIW, this is why you can simply write jQuery AJAX calls just by specifying the dbid where the URL goes:

$.get(dbid,{
act: "API_DoQuery",
qid: "1"
});

Using relative URLs for internal links in a web site is a rock solid practice and it applies to QuickBase as well. You only need absolute URLs if you are linking to an external URL or to a QuickBase link on another subdomain. For some odd reason the practice of writing absolute URLs for QuickBase has spread when it is quite unnecessary. If you have an example to the contrary send me the info.
Photo of Robert

Robert

  • 210 Points 100 badge 2x thumb
Thank you!  That resolved the syntax issues, however when I run the URL (formula) it doesn't populate the data into the fields on the form...?  (I can see  in the URL that the field ids and the correct data that should go into them are there, but on the form they don't display.  The form is still expecting the user to "make a selection"...
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,184 Points 20k badge 2x thumb
You are using "_fld_6" with an "l"  instead of "_fid_6" with an "i". QuickBase is simply ignoring the parameters it does not understand so no fields are populated and no error is generated.
Photo of Robert

Robert

  • 210 Points 100 badge 2x thumb
Rookie mistake (or I need better glasses!)  Thanks, that did it and working great!
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,184 Points 20k badge 2x thumb
Do us a favor and try the formula without the leading:

URLRoot() & "db/" &

and post the results of your test.
Photo of Robert

Robert

  • 210 Points 100 badge 2x thumb
Using the URL Root()... did not work.  If you would like me to test something else, let me know.
And thanks for your help!
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 4,414 Points 4k badge 2x thumb
Robert - is your formula working?
Photo of Robert

Robert

  • 210 Points 100 badge 2x thumb
Sorry for the confusion... yes my formula is working WITH the URLRoot()... it does not work without it.