Skip to main content
Question

Creating a child record from a button on the parent form and automatically return back to the parent form after the child has been saved.

  • Aug 24, 2017 12:15 PM UTC
  • 39 replies
  • 254 views

Show first post
This topic has been closed for replies.

39 replies

  • Author
  • Qrew Cadet
  • Aug 27, 2017 4:59 AM UTC
Is there a function I can add to the formula you provided that will allow a user access to the root cause record created by the add button? After a record is added I want to disable the user from adding multiple records to the same row and only allow access for editing the record that was created.


var text URLONE = URLRoot() & "db/" & [_DBID_ROOT_CAUSE] & "?a=API_GenAddRecordForm&_fid_17=" & URLEncode ([Record ID#]); 

var text URLTWO = URLRoot() & "db/"  & [_DBID_DAMAGE] & "?a=dr&rid=" & [Related Incident];

 

$URLONE

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

You make make a summary of the minimum of the Record ID# of the root cause record.  Call it [Record ID# of the Root Cause]

Then change the button to this (not tested)

var text URLONE = URLRoot() & "db/" & [_DBID_ROOT_CAUSE] & "?a=API_GenAddRecordForm&_fid_17=" & URLEncode ([Record ID#]); 

var text URLTWO = URLRoot() & "db/"  & [_DBID_DAMAGE] & "?a=dr&rid=" & [Related Incident];

var text ADD =  

$URLONE

& "&NextURL=" & URLEncode($URLTWO);

var text EDIT = URLRoot() & "db/" & [_DBID_ROOT_CAUSE] & "?a=dr&rid=" & [Record ID# of the Root Cause];

IF([Record ID# of the Root Cause]>0, $EDIT, $ADD)

  • Author
  • Qrew Cadet
  • Aug 27, 2017 6:34 AM UTC
I've created "Record ID# of the Root Cause" and made it a summary in (Damage Parts) Table and I have updated the formula in the add button. Everything seems to take, but after creating a root cause record the button does not allow me to edit and does allows me to keep adding records. Is the If statement for the edit/add part of the formula for the button? I have included that as well.

Please post your formula

Also, two more things.  Where do you want to leave the user after they save the root cause edit?

Also if you want to land the user on edit mode on the root case, this line needs to read as below (er instead of dr,   (er means edit record.  dr means display record)


var text EDIT = URLRoot() & "db/" & [_DBID_ROOT_CAUSE] & "?a=er&rid=" & [Record ID# of the Root Cause];

  • Author
  • Qrew Cadet
  • Aug 27, 2017 11:59 PM UTC
This is the current formula I have for the "Add button" the leads to the root cause form.


var text URLONE = URLRoot() & "db/" & [_DBID_ROOT_CAUSE] & "?a=API_GenAddRecordForm&_fid_17=" & URLEncode ([Record ID#]); 

var text URLTWO = URLRoot() & "db/"  & [_DBID_DAMAGE] & "?a=dr&rid=" & [Related Incident];

var text ADD =  

$URLONE

& "&NextURL=" & URLEncode($URLTWO);

var text EDIT = URLRoot() & "db/" & [_DBID_ROOT_CAUSE] & "?a=dr&rid=" & [Record ID# of the Root Cause];

If([Record ID# of the Root Cause]>0, $EDIT, $ADD)



So far it's doing everything correct but to enable the user to get back to the record in the root cause for that was created.

I want the leave the user in the parent form (Damage) since that's the only form table they will have access to.

I want the button to do 2 functions if possible; 1 enable the user to create the record in root cause and 2 after the record is created have access to the record without letting the users create multiple records for that same row.

Below was a workaround I was working on last night in case I don't get the button to function the way I need it. I would rather have access to add/edit function through "Add Investigation" button.

"Root Cause Related Damage Parts Incidents2" on the right Leads the user to the record that was added once a root cause has been saved. Top row had a record added, bottom row has not had a record added.




I feel like we're so close to solving this problem!!!

There must be a problem with that Summary field.


For a record with a child root cause record, what is the value on that field.

  • Author
  • Qrew Cadet
  • Aug 28, 2017 2:41 AM UTC
The value in the Summary field is 1 for [Record ID# of the Root Cause]

Here are the settings.


If the value in that Summary minimum Record ID is a 1, then the IF must be performing the EDIT formula variable. If you have changed the "dr " to "er" then pushing the button must be displaying the root cause Record in edit mode, which I thought is what you wanted.

  • Author
  • Qrew Cadet
  • Aug 28, 2017 7:50 PM UTC
Yes, that is what I want. Once the root cause record is created I want the user to only to have access to edit that record and not able to keep "adding" new records.

What is currently happening is once the user creates a record for root cause the "add" button is not changing to edit mode and allows the user to keep adding new records.

I would have to see you app to debug the issue. I can be contacted via my website QuickBaseCoach.com

My response has been slow today as I have had a technical issues not being able to sign onto the forum today on most of my devices.

  • Observing
  • Feb 9, 2018 11:08 PM UTC
What about the following:
var text URLONE=URLRoot() & "db/" & [_DBID_Tasks] & "?a=API_GenAddRecordForm&_fid_11=" & URLEncode ([Record ID#])& 
"&_fid_60=" & [03 IDD]& 
"&_fid_61=" & [03 EDD]&;

var text URLTWO=URLEncode("https://DOMAINNAME.quickbase.com/db/DBID2?a=q&qid=REPORT ID");

$URLONE
& "&NextURL=" & URLEncode($URLTWO)

Getting an invalid formula after the semicolon following &[03 EDD]&

Forum|alt.badge.img+6
  • Qrew Corporal
  • Apr 11, 2018 3:06 AM UTC
Mark, where would you add the dfid if you want to return to a specific parent form?

Kelly, 
it would be something like this

var text URLONE = URLRoot() & "db/" & [_DBID_ROOT_CAUSE] & "?a=API_GenAddRecordForm&_fid_17=" & URLEncode ([Record ID#]); 

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

 

$URLONE

& "&NextURL=" & URLEncode($URLTWO);