Help with URL Button formula to select from multiple choice field

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
Hi, 
I have put the below URL formula in a button. The objective is to create a new record and populate field ID 31 (this is a multiple choice field) with "Daily Cost". 

URLRoot() & "db/" & [_DBID_NEWITEMS] & "?a=API_GenAddRecordForm&_fid_47=" 
& "&_fid_32=Daily Cost"

& URLEncode ([Record ID#])& "&z=" & Rurl()

When I press the button the new record is created but instead of selecting "Daily Cost" the formula creates another multiple choice selection "Daily Cost2". Any advice on my formula would be appreciated. 

Thanks,
Photo of Chris Phair

Chris Phair

  • 100 Points 100 badge 2x thumb

Posted 2 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
try this

URLRoot() & "db/" & [_DBID_NEWITEMS] & "?a=API_GenAddRecordForm&_fid_47=" 
& "&_fid_32=" & urlencode("Daily Cost")
Photo of Matthew Neil

Matthew Neil

  • 31,478 Points 20k badge 2x thumb
There is an error with the code where your record id is?  Its not linking that properly, so its actually amending that status with the record ID.
Try it on a different record and my hunch it will be a different number "Daily Cost3"
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
Chris,
Matthew is correct.  Are you creating a child record?  if so, you need to also populate the field for [Related Parent] whatever fid that is, with the record ID#.
Photo of Matthew Neil

Matthew Neil

  • 31,478 Points 20k badge 2x thumb
you need to have the fid of the [Related Parent] so the [Record ID#] can be written to that field in the new form.

You might have deleted something when you modified the button, but here is a clean example.

URLRoot() & "db/" & [_DBID_NEWITEMS] & "?a=API_GenAddRecordForm&_fid_8=" & URLEncode ([Record ID#])& "&_fid_32=" & URLEncode ("Daily Cost")& "&z=" & Rurl()

where fid_8 is the field ID on the NewItem table called [Related XXXXXX]
Photo of Chris Phair

Chris Phair

  • 100 Points 100 badge 2x thumb
Thank you both for the quick reply and solution. The final code worked perfectly. 

This was my first attempt and URL coding (thanks to your URL Formulas buttons for Dummies app). 

Cheers,
Chris
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 52,786 Points 50k badge 2x thumb
Great, thx for letting us know. We were double teaming you :)