Check a box while opening a new record

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • In Progress
I would like to mark the parent record assigned at the same time a new child record is created, in one scenario. So what can I add to the existing 'Add Record' formula to do that? 

URLRoot() & "db/" & [_DBID_LOCATIONS] & "?a=API_GenAddRecordForm&_fid_10=" & URLEncode ([Record ID#])& "&z=" 

-and-

In another scenario, I am looking to populate the Date/Time field while opening a new record. 
What can I add to my existing Time Stamp Button formula to do that?

var text URL = URLRoot() & "db/" & Dbid() &   "?act=API_EditRecord&rid=" &([Record ID#])
& "&_fid_29=" & Now();

"javascript:" &
"$.get('" &
$URL &
"',function(){" &
"location.reload(true);" &
"});" & "void(0);"
Photo of Kelly

Kelly

  • 1,772 Points 1k badge 2x thumb

Posted 1 year ago

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

QuickBaseCoach App Dev./Training, Champion

  • 53,038 Points 50k badge 2x thumb
Fr the first one, I suggest that you consider an alternative approach.  If the "definition" of a parent record being assigned is that it has a child record, how about adding a summary field for the [# of children]

Then make the checkbox field for [Parent Record assigned?] can be

[# of children] >0

or if you prefer to be needlessly verbose,

IF([# of children] >0, true, false)

As for the second question, are you saying that whenever the record is manually edited you want to set a date/time field to now()?  If that is the case, why not just use the built in [date modified] field  as it will be auto populated with the date/time of the last edit.
Photo of Matthew Neil

Matthew Neil

  • 31,478 Points 20k badge 2x thumb
If you are looking to edit the parent record then create a child record, you will want to use an

API_EditRecord call with a RDR to the AddGenRecordFrom.

Generally speaking it will look like this: 

URLRoot() & "db/" & [_DBID_TASKS] & "?a=API_EditRecord&rid="&[Record ID#]&"&apptoken=xxxxxx&_fid_12="&URLEncode("true")&"&_fid_39="&URLEncode(User())&"&_fid_48="&URLEncode(Now())&"
&rdr="&
URLEncode([URL Add Time Entry])

This one Edits the parent task (marks complete) and redirects to add a time entry.
Photo of Kelly

Kelly

  • 1,772 Points 1k badge 2x thumb
In both situations, I just want to execute an action based on the push of a formula button that already exists. The idea is just to streamline the workflow from 2 steps to 1.
Photo of Kelly

Kelly

  • 1,772 Points 1k badge 2x thumb


I want to consolidate the 2 buttons into one step.
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb

[Location Assigned]& "&rdr=" & URLEncode([Add Location])

This might do it.

Photo of Kelly

Kelly

  • 1,772 Points 1k badge 2x thumb
This is what I'm getting: A formula may not contain a reference to itself directly or indirectly through another formula.
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
Create a new field for the combined effort.
Photo of Kelly

Kelly

  • 1,772 Points 1k badge 2x thumb
The Location Assigned Worked, but a window didn't open to add a new location.