Discussions

Expand all | Collapse all

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.

QuickBaseCoach Dev./Training08-25-2017 03:23

QuickBaseCoach Dev./Training08-27-2017 00:34

QuickBaseCoach Dev./Training08-27-2017 10:33

QuickBaseCoach Dev./Training02-09-2018 19:14

QuickBaseCoach Dev./Training02-09-2018 19:32

QuickBaseCoach Dev./Training02-09-2018 19:35

Kelly Kelly04-11-2018 02:34

  • 1.  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.

    Posted 08-24-2017 08:15
    Creating a child record from a button on the parent form and automatically returning back to the parent form after the child record has been saved.

    User is on parent form and adds a record to the child form through a button. Is there a way to automatically return back to the parent form after the child form has been saved? If not, it there a way to indicate on the button that a child record has been created for the parent record by changing the color of the button? This is my existing formula  URLRoot() & "db/" & [_DBID_ROOT_CAUSE] & "?a=API_GenAddRecordForm&_fid_17=" & URLEncode ([Record ID#])& "&z=" & Rurl()



    Thanks All,
    Evan


  • 2.  RE: 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.

    Posted 08-24-2017 11:51
    Evan,

    That is very odd, because your button looks quite normal and the bit at the end with the &z=... tells QuickBase to redisplay the Parent record after saving.


    Is there anything else unusual here in your setup. I can provide an alternative to that code which would probably work, but I'm not understanding what is different about your use case where the normal Add child button is not returning to the Parent.


    What is happening now after you save the child?


  • 3.  RE: 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.

    Posted 08-24-2017 17:42

    I see what you mean. Yes it does return back. Sorry for the confusion, I explained my setup incorrectly. I have a parent form that has a child table inside it with a button that leads to the grandchild. Is it possible to return back to the parent form after the grandchild record has been saved? Is there also a way to indicate on the button that a grandchild record has been created after it's been saved? I need an indication to avoid saving multiple records related to the same record. Thanks so much for the help!


  • 4.  RE: 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.

    Posted 08-24-2017 18:23
    OK, now it makes sense.  The magic is using "&NextURL= ....

    No problem,

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

    var text URLTWO = URLRoot() & "db/"  & [_DBID_the table name of the parent] & "?a=dr&rid=" & [Related Parent];

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


    I am using formula variables for readability and when you link the next thing for QuickBase to do, you need to URLEncode it.  Not sure why, but that's the syntax to make it work.


  • 5.  RE: 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.

    Posted 08-24-2017 18:53
    i did update the fields and I am now receiving the error "Formula syntax error

    There are extra characters beyond the end of the formula."

    URLRoot() & "db/" & [_DBID_ROOT_CAUSE] & "?a=API_GenAddRecordForm&_fid_17=" & URLEncode ([Record ID#])& "&z=" & Rurl()

      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 Damage Parts Incidents2 - Related Incident];

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

    Am I missing something?

    Thanks for your help!


  • 6.  RE: 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.

    Posted 08-24-2017 18:56
    //You just need this part. this replaces your original formula.  



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

    var text URLTWO = URLRoot() & "db/"  & [_DBID_the table name of the parent] & "?a=dr&rid=" & [Related Parent];

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


  • 7.  RE: 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.

    Posted 08-24-2017 21:10
    Fantastic! The formula does return me back to the parent table but the only problem now is if my parent table houses multiple records in the child table, it returns me back to a different parent record every time I save a grandchild record.



    Below is the child table inside the parent form leading to the grand child record button



    Thank you!


  • 8.  RE: 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.

    Posted 08-24-2017 22:11
    Now I am confused again as to what the problem is.

    Can you describe your relationships and use the real names of the tables?. And then explain using the real names of the tables what the problem is?


  • 9.  RE: 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.

    Posted 08-24-2017 22:55
    Sorry for the confusion. I have a Damage table (Parent) that has a child table (Damage Parts) embedded in the parent table. My Damage Parts table inside the parent form has a button that leads to the grand child table (Root Cause) for every row in the table.

    Child table (Damage Parts) in the Parent Table (Damage) the leads to Grand Child "Add Investigation" (Root Cause)


    Table Record Flow
    Damage >> Damage Parts >> Root Cause
    (Once record is saved in Root Cause, I want to return back to original Damage incident)

    The problem is once I create a grand child record through "Add Investigation" it returns me back to the parent table (Damage) but it's returning me to the different record.

    I should note, in your formula I did reference record ID in the Parent Table for [Related Parent]; is this correct?

    Thanks so much for the help!


  • 10.  RE: 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.

    Posted 08-25-2017 03:23
    Can you post your actual code for the button?


  • 11.  RE: 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.

    Posted 08-25-2017 05:21
    Here is my current code...


    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=" & [Record ID#];

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


  • 12.  RE: 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.

    Posted 08-25-2017 11:56
    The problem is the the URLTWO

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

    Stop and think about where is the user is when they push this button. They are sitting on a damage parts record. The record that you want to display is in the table above that which is called damage. The record ID that you want to display in the damage table is in fact the parent of the damage parts record. And that record ID is likely called [related damage].


  • 13.  RE: 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.

    Posted 08-25-2017 17:14
    Yes! That was the trick!!!

    Now, instead of enabling the user to create multiple Grand Child Records (Root Cause) through the button, is there a way to disable the button from adding multiple records after an initial record has been created and possibly indicating on the button such as a color change to tell the user a record has been created? Essentially I just want the user to edit the original record through the button instead of creating new records.

    Your help is greatly appreciated!!


  • 14.  RE: 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.

    Posted 08-25-2017 17:19
    no problem,
    you can make a summary field of the [# of root causes] on he relationships between damage parts and root causes.

    Then instead of where it says

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

    replace that with

    IF([# Root Causes]=0,
    $URLONE
    & "&NextURL=" & URLEncode($URLTWO))

    The button will be blank after the first one is added.


  • 15.  RE: 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.

    Posted 08-25-2017 22:27
    This works great, but now the button disappears disabling any link to the created record. Is there a way to keep the link accessible in cases where the user needs to edit the record?

    thanks!!


  • 16.  RE: 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.

    Posted 08-25-2017 22:30
    I don't understand.

    The purpose of the button was to add a new record, not to edit an existing record. If the user needs to edit the record they should just edit the record with the edit pencil icon.


  • 17.  RE: 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.

    Posted 08-25-2017 22:55
    I needed to create an add button because I want to limit the access to only a few tables. The user only has access to the "Root Cause" form through the parent form "Damage" which is accessible only through the add button.


  • 18.  RE: 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.

    Posted 08-25-2017 23:02
    Why not have a child table of the root cause on the damage parts table?


  • 19.  RE: 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.

    Posted 08-26-2017 00:08
    If I create a child table (root cause) on the damage parts table, will this require me to show all the field criteria on the table or can I have a button that will link the user directly to the form for editing?


  • 20.  RE: 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.

    Posted 08-26-2017 12:37
    When you put th Report Link field type for the ROot Cases in the Damanage Parts form, you can specify that the child records ( just one record in your case) should appear directly on the form in a report. You may them create an unfiltered report to use to decide which columns (fields) of the rooot causes, you want to show to the users.

    Users can then choose to either view the root because or edit it.


  • 21.  RE: 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.

    Posted 08-26-2017 20:07
    I do have several form rules setup on for my Root Cause form. Will these also work through a report link?


  • 22.  RE: 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.

    Posted 08-26-2017 20:29
    If the user views a root cause Record, then the form rules will kick in regardless of how the user found their way to the record, so yes, your form rules will work.


  • 23.  RE: 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.

    Posted 08-26-2017 21:43
    Sorry, this is my first time using forms, tables and using Quickbase.

    Will this allow the user to add a new record in root cause form and access that same record with ability to edit through the damage parts table? So far I seem to have everything in place but the accessibility to the record that was added in Root Cause.


  • 24.  RE: 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.

    Posted 08-26-2017 22:31
    If you have a Report link field on the damage parts table and choose to show the root cause records directly on the form, then you also get a choice as to whether that embedded table is editable. That is a setting on the form property for that report link field.

    If you make that editable, that means that when you edit the damage parts record the root causes become editable as well in what is called the grid edit format.

    However if you have form rules they will not be applicable in grade edit format, and also of course there is a realistic limit to how wide you would want to make that embedded report in terms of the number of fields.

    If you have a complicated root cause for him with many fields then it will be more practical to have the users click the pencil icon on the embedded report on the damage parts record and edit on the full form.

    Just to confirm, can you confirm that you do in fact have an a better table of the root causes with the records directly showing on the damage parts record?


  • 25.  RE: 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.

    Posted 08-26-2017 23:43
    That's essentially what I did here. This is a child table (Damage Parts) embedded in the parent form (Damage). At the end to the right "Add Investigation" is the button link to the grandchild form (Root Cause). I want to avoid adding root cause fields since the table is already too long and I don't want those fields visible to all users.



    Workflow direction example Damage >> Damage Parts >> Root Cause


  • 26.  RE: 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.

    Posted 08-27-2017 00:34
    Was that a question?


  • 27.  RE: 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.

    Posted 08-27-2017 00:59
    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)


  • 28.  RE: 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.

    Posted 08-27-2017 01:07
    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)


  • 29.  RE: 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.

    Posted 08-27-2017 02:34
    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.


  • 30.  RE: 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.

    Posted 08-27-2017 10:33
    Please post your formula


  • 31.  RE: 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.

    Posted 08-27-2017 12:10
    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];


  • 32.  RE: 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.

    Posted 08-27-2017 19:59
    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!!!


  • 33.  RE: 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.

    Posted 08-27-2017 20:54
    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.


  • 34.  RE: 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.

    Posted 08-27-2017 22:41
    The value in the Summary field is 1 for [Record ID# of the Root Cause]

    Here are the settings.



  • 35.  RE: 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.

    Posted 08-28-2017 10:03
    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.


  • 36.  RE: 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.

    Posted 08-28-2017 15:50
    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.


  • 37.  RE: 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.

    Posted 08-28-2017 23:08
    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.


  • 38.  RE: 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.

    Posted 02-09-2018 18:08
    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]&


  • 39.  RE: 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.

    Posted 02-09-2018 18:48
    Remove the last & in urlone.

    var text URLONE=URLRoot() & "db/" & [_DBID_Tasks] & "?a=API_GenAddRecordForm&_fid_11=" & URLEncode ([Record ID#])&
    "&_fid_60=" & [03 IDD]&
    "&_fid_61=" & [03 EDD];


  • 40.  RE: 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.

    Posted 02-09-2018 18:53
    OK that works but it doesnt save the new record and when I hit save and close I get a bad URL (We Cant Understand....) error


  • 41.  RE: 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.

    Posted 02-09-2018 19:14
    Please post your actual code.


  • 42.  RE: 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.

    Posted 02-09-2018 19:15
    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://capitalimpact.quickbase.com/db/bmddpcay2?a=q&qid=162");

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


  • 43.  RE: 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.

    Posted 02-09-2018 19:18
    Try this for URLTWO

    var text URLTWO="https://capitalimpact.quickbase.com/d...";


  • 44.  RE: 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.

    Posted 02-09-2018 19:18
    I�m not that posted properly. Basically in URLTWO, do not URLEncode.


  • 45.  RE: 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.

    Posted 02-09-2018 19:21
    That works, so last question is there a way to skip opening the child record and having to hit save and close?


  • 46.  RE: 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.

    Posted 02-09-2018 19:27
    If you change

    API_GenAddRecordForm

    to

    API_AddRecord

    Then it will add a record without user interaction.


  • 47.  RE: 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.

    Posted 02-09-2018 19:30
    I made the change to API_AddRecord but now I get an XML error
    <qdbapi>
    <action>API_AddRecord</action>
    <errcode>0</errcode>
    <errtext>No error</errtext>
    <rid>2401</rid>
    <update_id>1518204553919</update_id>

    </qdbapi>


  • 48.  RE: 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.

    Posted 02-09-2018 19:31
    If I hit back on the browser I do see it updated with a child record but it cant seem to get back to the report


  • 49.  RE: 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.

    Posted 02-09-2018 19:32
    Please post your code.


  • 50.  RE: 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.

    Posted 02-09-2018 19:33
    var text URLONE=URLRoot() & "db/" & [_DBID_Tasks] & "?a=API_AddRecord&_fid_11=" & URLEncode ([Record ID#])& 
    "&_fid_60=" & [03 IDD]& 
    "&_fid_61=" & [03 EDD];

    var text URLTWO="https://capitalimpact.quickbase.com/db/bmddpcay2?a=q&qid=162"">https://capitalimpact.quickbase.com/db/bmddpcay2?a=q&qid=162"">https://capitalimpact.quickbase.com/db/bmddpcay2?a=q&qid=162";

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


  • 51.  RE: 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.

    Posted 02-09-2018 19:34
    just to note I did not get the XML error with the GenAddRecordForm only started after changed to AddRecord


  • 52.  RE: 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.

    Posted 02-09-2018 19:35
    Change NextURL to rdr

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


  • 53.  RE: 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.

    Posted 02-09-2018 19:38
    Perfect.  You Are The Man.  I appreciate your help today.


  • 54.  RE: 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.

    Bronze
    Contributor
    Posted 04-10-2018 23:06
    Mark, where would you add the dfid if you want to return to a specific parent form?


  • 55.  RE: 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.

    Posted 04-11-2018 02:21
    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);


  • 56.  RE: 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.

    Bronze
    Contributor
    Posted 04-11-2018 02:34
    Thanks, Mark!