Discussions

Expand all | Collapse all

Modify the add child record button to also change a field on the child record

Trish Wehrle02-12-2019 18:04

  • 1.  Modify the add child record button to also change a field on the child record

    Posted 02-11-2019 20:59
    I have a table of audit findings and I'm  creating a child table of workflow records. I'd like a formula url button on the audit finding for each action of the workflow process, ie, Send to Response Owner, Send to SME, Send to Auditor...
    Clicking each button would add a record to the Workflow child table and then update the 'Action' field (fid 11) on the workflow child form with the name of the button clicked ie "Send to Response Owner"

    how do i modify this formula url so when the button is clicked it adds a record but also updates the 'Action' field

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

    Thanks!


  • 2.  RE: Modify the add child record button to also change a field on the child record

     
    Posted 02-11-2019 22:14
    Field values can be added to these statements using the _fid_X=YOUR_VALUE syntax. In fact, you are already doing this when you enter the Record ID for the parent record here:
    &_fid_8=" & URLEncode ([Record ID#]) 

    So in your case to add another field you would just another statement like this for your other field:

    &_fid_11=" & URLEncode ([Action])

    Which would end up looking like this:

    URLRoot() &
    "db/" & [_DBID_WORKFLOW] &
    "?a=API_GenAddRecordForm" &
    "&_fid_8=" & URLEncode ([Record ID#]) &
    "&_fid_11=" & URLEncode ([Action]) &
    "&z=" & Rurl()

    As a sidenote, you may have noticed I split this formula onto multiple lines. This is perfectly fine, and I would suggest doing so when you have longer formulas like this so you can see exactly what's going on.




  • 3.  RE: Modify the add child record button to also change a field on the child record

    Posted 02-12-2019 13:31
    Thank you so much for the response. So if i wanted the 'Action' field to be populated with the words "Send to Response Owner", how would i do that?


  • 4.  RE: Modify the add child record button to also change a field on the child record

     
    Posted 02-12-2019 17:56
    This is a bit more of a long/technical answer, but hopefully it helps teach a man to fish more than just giving you the fish :). If you follow the first example you should be able to do what you are asking with no trouble.

    What you are actually doing here is building a URL with parameters, pointed to your QuickBase database. When you click that button, you are in effect sending a request to QuickBase, which it then interprets. Each piece of the URL is a variable that gives information to the server to process your request. You can read it like:

    URLRoot() & // At my QuickBase domain
    "db/" & [_DBID_WORKFLOW] & // At the Workflow Table
    "?a=API_GenAddRecordForm" & // Do the action "API_GenAddRecordForm" (open a new record page)
    "&_fid_8=" & // Fill in the field with field ID 8
    URLEncode([Record ID#]) & // With the Record ID# from this record. URLEncode the value so it doesn't get jumbled up
    "&_fid_11=" & // Fill in the field with field ID 11
    URLEncode([Action) & // With the Action value from this record. URLEncode the value so it doesn't get jumbled up.

    "&z=" & Rurl() // And when I save this form, redirect me back the page I'm on right now.

    Any field you want to pre-populate in the form is added with whatever value you put after it. You can do this for any number of fields, and with static or formulated values. So for example let's say I have a table Prides, and each Pride has many Lions. The Lion table has an field Type, with a field ID of 12. I want a button that lets me add a new Lion to a Pride, and every time fills in the Type of Lion with "Cub".

    Based on the example above, I know I need to update my Add Lion formula field with a new parameter so it fills in when I open the form. I can add parameters to my search using the "_fid_X=YOUR_VALUE" syntax I mentioned in my first post.

    My field ID is 12, so first I replace X with 12:
    "_fid_12=" & YOUR_VALUE
    Now I need to give it a value. I want the value to always be "Cub". First I'll URLEncode it to make sure its safe to add to my formula:
    URLEncode("Cub") 
    Then I'll add that to my formula for a complete parameter:
    "_fid_12=" & URLEncode("Cub")
    Now that I have my parameter figured out, I need to add it to the rest of my formula. I know each parameter needs to be separated by an ampersand(&) so I'll add one in front, and add the whole thing to my formula:

    URLRoot() & // At my QuickBase domain
    "db/" & [_DBID_LIONS] & // At the Lions Table
    "?a=API_GenAddRecordForm" & // Do the action "API_GenAddRecordForm" (open a new record page)
    "&_fid_12=" & URLEncode("Cub")" & // We just added this value. "&z=" & Rurl()
    My button will now open a new Lion form page, and populate my Type field with "Cub". 

    If you've gotten this far, you should now be able to complete your button in the exact same way. It doesn't matter whether the value you add is a static value or not. You can also add as many parameters as you want. In fact, we can even take this a few steps further:

    First, let's use some variables to make it a bit more readable. Using variables can be helpful to keep things more organized as your formulas get longer, and helps you think about your Formula in more manageable pieces.
    var text URL = URLRoot() & "db/" & [_DBID_LIONS]; var text action = "?a=API_GenAddRecordForm"; var text redirect = "&z=" & Rurl(); var text lionType = "&_fid_12=URLEncode("Cub")";  $URL & $action & $lionType & $redirect
    This makes our formula a lot easier to read. Imagine we wanted to add a whole bunch of other pre-filled values to our form, or our values were more complicated:

    var text URL = URLRoot() & "db/" & [_DBID_LIONS]; var text action = "?a=API_GenAddRecordForm"; var text redirect = "&z=" & Rurl();  var text lionTypeField = "&_fid_12=" var text lionTypeValue = If([Pride Type] = "Evil",   URLEncode("A monkey's uncle"),   URLEncode("Cub") ); var text lionType = $lionTypeField & $lionTypeValue;  var text lionColor = "&_fid_13=" & URLEncode([Pride Color]);  $URL & $action & $lionType & $lionColor & $redirect
    You can see that even though some of our values are starting to get a bit complex, and our formula is getting long, our final URL formula is very easy to read, and each value can be understood quickly.

    This got a lot longer than I planned so I'm going to end it here...but I hope that helps!


  • 5.  RE: Modify the add child record button to also change a field on the child record

    Posted 09-30-2019 16:12
    This is awesome. Very helpful. One piece I am having trouble with is the redirect...

    "&z=" & Rurl() // And when I save this form, redirect me back the page I'm on right now.

    How would I modify this to instead save and send to a different page? Right now I have the button I would like to use on a dashboard.

    ------------------------------
    Jacob Linn
    ------------------------------



  • 6.  RE: Modify the add child record button to also change a field on the child record

    Posted 09-30-2019 17:28
    You can make a button like this to add a record and then land the user somewhere designated. 

    var text URLONE = ..............; (the API_AddRecord)
    var text URLTWO = ..............;

    $URLONE
    & "&NextURL=" & $URLTWO




    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------



  • 7.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 09:57
    Here is my formula:

    var text URLONE = URLRoot() & 
    "db/" & [_DBID_RESERVATIONS] & 
    "?a=API_GenAddRecordForm" & 
    "&_fid_6=" &
    URLEncode([Record ID#]) & 
    "&_fid_14=" & 
    URLEncode(User()) & 
    "&z=" & Rurl()

    ;

    var text URLTWO = "My URL for the dashboard";

    $URLONE
    & "&NextURL=" & $URLTWO


    ----------

    It doesnt look like anything has changed? I'm still left at the record in edit mode instead of the record saving and taking me to my URLTWO URL.

    ??

    ------------------------------
    Jacob Linn
    ------------------------------



  • 8.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 10:01
    They this change to URLONE

    var text URLONE = URLRoot() & 
    "db/" & [_DBID_RESERVATIONS] & 
    "?a=API_GenAddRecordForm" & 
    "&_fid_6=" &
    URLEncode([Record ID#]) & 
    "&_fid_14=" & 
    URLEncode(User());


    ie drop drop off the last part.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------



  • 9.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 10:51
    Something isnt working properly :(

    Still no save and no redirect. Button creates the child record and fills in the fields I'm telling it to but I'm looking at the record in edit mode.

    ------------------------------
    Jacob Linn
    ------------------------------



  • 10.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 11:02
    Can you do a test for me? Can you try that same button but push it in view mode rather than edit mode?

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------



  • 11.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 11:13
    Hey Mark, this button is being displayed on a report in the dashboard.

    Vehicles have Reservations. Add Reservation button on the "Available Vehicles" Report on the dashboard is modified to:

    Create Reservation (works)
    Bring over the Vehicle Number from the parent record (works)
    Bring over the current user (works)
    Save (doesn't work)
    Redirect back to dashboard (doesn't work)

    Thanks in advance for any further guidance.

    ------------------------------
    Jacob Linn
    ------------------------------



  • 12.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 11:17
    Can you post your complete current formula and also explain what you mean by the Save doesn't work?
    There must be a great big green save button. How can that not work?


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------



  • 13.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 11:25
    Current formula (Based on your first post):

    var text URLONE = URLRoot() & 
    "db/" & [_DBID_RESERVATIONS] & 
    "?a=API_GenAddRecordForm" & 
    "&_fid_6=" &
    URLEncode([Record ID#]) & 
    "&_fid_14=" & 
    URLEncode(User()) & 
    "&z=" & Rurl()

    ;

    var text URLTWO = "My URL for the dashboard";

    $URLONE
    & "&NextURL=" & $URLTWO


    --------

    I also attempted removing this:  "&z=" & Rurl() and there was no difference in outcome.

    --------

    There may be some confusion about my works/doesn't work list. These are things that the button is supposed to do. Once I press the button it makes the record and brings the data to the correct fields but I am left in edit mode when I want the button to also save the record and redirect me back to the dashboard (the URL in URLTWO). 

    The idea is a seamless process where a user will see a vehicle in a list of available vehicles and press a button to create a reservation for that vehicle then be brought back to their dashboard. My URL button to return said reserved vehicle was much much easier to create since I was only editing the record that the button was being launched from.


    ------------------------------
    Jacob Linn
    ------------------------------



  • 14.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 11:29
    My apologies. My post was incorrect. Leave off the last part where it says z=equals etc. but the formula needs this. 

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

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------



  • 15.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 11:42
    var text URLONE =
    URLRoot() & 
    "db/" & [_DBID_RESERVATIONS] &
    "?a=API_GenAddRecordForm" & 
    "&_fid_6=" &
    ([Record ID#]) &
    "&_fid_14=" &
    URLEncode(User())      ;

    var text URLTWO = "xxx.quickbase.com/db/abc123";

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


    -------

    No change :(  Still seeing all of the proper information but I am looking at the record in edit mode instead of the record being saved and me seeing the dashboard.

    ------------------------------
    Jacob Linn
    ------------------------------



  • 16.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 12:06
    I'm not understanding why you are landing on edit mode but try this can you try this for URLTWO?  I think it may want the full URL including the https:// so this would do that.

    var text URLTWO = URLRoot() & "db/" & "abc123";

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------



  • 17.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 12:18
    No dice :(

    var text URLONE =

    URLRoot() & 
    "db/" & [_DBID_RESERVATIONS] & 
    "?a=API_GenAddRecordForm" & 
    "&_fid_6=" & 
    ([Record ID#]) &
    "&_fid_14=" & 
    URLEncode(User())

    ;

    var text URLTWO = URLRoot() & "db/" & "abc123";


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

    ------------------------------
    Jacob Linn
    ------------------------------



  • 18.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-01-2019 13:18
    I will do a test myself when I get a chance in the next day or so.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------



  • 19.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-02-2019 01:15
    Are you in view mode on the Parent Record when launching Add Child. I believe it works in View mode, but not a Edit mode.  In edit mode you will return to the Parent.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------



  • 20.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-02-2019 09:54
    I'm launching from a report on a dashboard, not from a form at all.

    ------------------------------
    Jacob Linn
    ------------------------------



  • 21.  RE: Modify the add child record button to also change a field on the child record

    Posted 10-02-2019 10:00
    I tested and it works for me. Contact me directly if you like and I will find a time to have a look on a Go To Meeting session. 
    mark.shnier@gmail.com

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------



  • 22.  RE: Modify the add child record button to also change a field on the child record

    Posted 02-12-2019 18:04
    This is so helpful, thank you so much!


  • 23.  RE: Modify the add child record button to also change a field on the child record

    Posted 02-12-2019 20:30
    We accomplish these workflow kind of functions with checkboxes and automations

    For example, here's a data entry form



    here's the automation trigger for one of those 'Assign to' checkboxes (the 'close ticket' and 'programming complete' checks do different things)



    Admittedly the form rules for those boxes are a bit of a pain
    ">https://d2r1vs3d9006ap.cloudfront.net/s3_images/1776668/RackMultipart20190212-111439-101ns2n-image_inline.png?1550003531">