Need help with URL Formula

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered
I have a URL Formula I am trying to write that should update a field on the record the user is on, and then refresh the record so they see the new info.  I keep getting an error telling me:

<qdbapi>
<action>API_EditRecord</action>
<errcode>30</errcode>
<errtext>No such record</errtext>
<errdetail>Missing "rid" parameter.</errdetail>
</qdbapi>

Here is my formula as it is right now:  **I added spaces, b/c  you have to, right??

var  text  URLONE =  URLRoot() & "db/" &  Dbid()
&  "?act=API_EditRecord&rid="  &  [Record ID#]
& "&_fid_7=" &  URLEncode (Today());

var text  URLTWO =  URLRoot() & "db/" &  Dbid() & "?a=dr&rid="  & [Record ID#];

$ URLONE

& "&rdr=" &  URLEncode($URLTWO)


Thank you in advance!!
Photo of Stephanie

Stephanie

  • 10 Points

Posted 4 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
The formula looks OK.  I suspect that you are trying to update a record which does not yet exist. ie if you are in Add Record mode and the record has never been initially saved, then when you click the button is it trying to update the Record ID of (blank).  Well there is no Record ID number (blank) so the formula fails.
Photo of Stephanie

Stephanie

  • 10 Points
Ah, that makes perfect sense.  So then here is the next question... is it possible to have a button on the parent to add a child and when it is added and opened, it is already saved and maybe even in edit mode??
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
The native Add Child button which is created for you on the right side of the Relationship will pop up an Add Record form. It pre-populates the [Related Parent] with the value of the [Record ID#] of the Parent record. You can adjust that button's formula to also pre-populate any other fields too.  But it will not be saved and then in edit mode, it will be in Add Record mode, unsaved, but with fields pre-populated.
Photo of Stephanie

Stephanie

  • 10 Points
Oh that is not good news - so there is NO way to, even through a different button on the parent to create a child record that already has its record id???

An alternative would be that the formula I already have on the child.. what if it doesn't NEED the record ID to do anything, can I just tell it to populate a field and not worry about refreshing and showing the record ID?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
You can push a button to create a record and display it - no problem.,  Just not have it display in edit mode.

I'm not understanding the second part of your question.

it would help me to help you if I understood the business situation or workflow you are trying to accomplish.  What do your tables represent in real life?
Photo of Stephanie

Stephanie

  • 10 Points
Ok so on my parent table - there is a group of ppl who may be viewing records and calling folks from records on the parent.  Right now, when they make the call, it goes into a logged field.  I can extract some information out of that but we have outgrown it and I need to get better statistics and so I am moving their calling logs/stats to a child table.

What I want them to be able to do - from the parent record, click a button to start the calling "process".  This would open the add record form for the child table.  While on that child record, they will be calling and then need to update a couple of fields on that child record - save it and then return to the original parent form they were on.

What I am trying to make happen here - when they click the button to add the child record (start their calling), I need to have a button on that child form that they click to say they are starting the actual call (in my perfect world, they would not be able to see the numbers until they click this button) - but when that button is clicked, I need it to populate a date/time field.  That is really all that particular button needs to do.

After they do that, they will be updating some notes fields, maybe a few others and then I want them to have a Save button that populates another field with the current date/time (goal is to log when they started and stopped the call and notes).  So when they save it, it would update that date/time field, save the record and then return to the parent.

I really appreciate any help!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
Each QuickBase record has a built in field for [Date Created] which as the date/time created.  How about taking away the Add Child Button and replace it with a Create Child button.  They would push a URL formula button and then land on that record in view mode. They would then edit the record to start their data entry, knowing that their clock started when they created the record.

Here is an example of a button to create a child and display it:

URLRoot() & "db/" & [_DBID_of the Child Table goes here] & "?act=API_AddRecord"
& "&_fid_12=" & [Related Parent]
& "&_fid_42=" & URLEncode([Component or Bulk item?])
& "&_fid_38=" & [Related Bulk item Master]
& "&_fid_24=" & [Related Component]
& "&_fid_28=" & ToText([Line Item Cost Override])
& "&_fid_53=" & URLEncode([PO Line Comment])
& "&disprec=1"
Photo of Stephanie

Stephanie

  • 10 Points
that should work!! but one thing.. is it possible to open that in edit mode once its created?? or no - if not, is there a way to use a formula to change it to edit mode instead of them using the edit at the top right?  It sounds a bit silly, I know, but its mainly for aesthetics and simplicity ..
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
No, It cannot display in edit mode. But it's easy to create a button to put anywhere on the form to edit

URLRoot() & "db/" & dbid() & "?a=er&rid=" & ToText([Record ID#])

If you wanted to get real fancy it can also be an icon to click on (or an icon plus words), but that would be a different question after you get this edit button working.  There are 502 icons here, available in 5 convenient sizes.
https://www.quickbase.com/db/9kaw8phg?a=ShowPage&pageid=134
Photo of Stephanie

Stephanie

  • 10 Points
Yep, I got some icons cooking, too - your idea is working perfect!! Thank you so much for your time on this.

One last question.  Is it possible to only display certain fields after they click that edit button?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
When you edit a record with a button, yes you can specify a form to be used.  In the example below I am forcing to use Form ID 10.  But when saved it will revert back to the default form for View.

URLRoot() & "db/" & dbid() & "?a=er&dfid=10&rid=" & ToText([Record ID#])

When i go to type &dfid=10 to help me remember the syntax I mentally say to myself

.. and duh Form ID =
Photo of Stephanie

Stephanie

  • 10 Points
well, I know how to do that - what I am asking... once they are on the form.... they are going to be in view mode.
They have to click the cool edit icon I made, and I want for certain fields to only show up AFTER they have clicked that edit icon
Photo of Stephanie

Stephanie

  • 10 Points
Haha, that was MY duh moment.  I already knew better - it's just a setting on the form for the field (only show while in edit or edit and add, etc). duhhhhh.

Thanks so much for all your help!!

I do have just ONE more little question though.

So now, after the edit - they are going to click on the cool Save icon.  I just need that to save the record and then go back to the parent form.......Can you give me some quick help with that?
Photo of Stephanie

Stephanie

  • 10 Points
Oh that's right - it also needs to populate a separate field with now() before saving
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,280 Points 50k badge 2x thumb
in order to get back to the Parent, they will need to use a hyperlink to get back to the parent form.  ie a link to the Parent record.  Typically this is done by showing the Proxy field for the [Related Parent] on the form and allowing it to be a link to the Parent.

As for changing the value of a field to now(), you may be able to simply use the [Date Last Modified field] to know when the record was last modified.