Discussions

 View Only
  • 1.  Create a new parent record based on criteria on child record

    Posted 10-15-2019 12:55
    I am working with a record tie in of a parent table being a total volume while a child record utilizes an amount of the parent.

    In certain instances the child record can create more volume in the parent, but with systems it has to be in a new line.

    So the long and short...

    I need to create a URL button that would get the parent info that is related to what is being used in the child and create a new record in the parent with that criteria.

    I started a formula with the API_GetrecordInfo  Which does great in giving me it all.  Now I just need to know how to "Copy" all of that data and then edit the record with the information created in the child record.

    I figured I could use javascript to form 3 URL's to accomplish this, just not sure the middle one.

    1st "Get info" which would pull all the information in the parent.

    2nd "Copy info" which would probably be a generate new record with the information of "Get info"

    3rd "Edit info" which I would believe is a simple translation of a few fid's to the represented data.

    I hope I did a good job explaining this.  Any help would be very much appreciated!

    ------------------------------
    Jeremy Cohen
    ------------------------------


  • 2.  RE: Create a new parent record based on criteria on child record

    Posted 10-15-2019 23:56
    Please clarify wha type of record you want to add, (Parent or Child) and if you want the button to be on the Oarent or the child.

    also please explain why you can't use the native Add child button which is created by the relationship.  Is it because you want a button to actually create the extra child Record and refresh the screen?

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



  • 3.  RE: Create a new parent record based on criteria on child record

    Posted 10-16-2019 08:49
    Hey Mark,

    Thank you for your response.

    I need to add a parent record while in the child form.

    I need it to create a new parent record while in the child based on a situation within the child record.  I took a stab at trying it as an automation but I definitely would prefer it to be a URL button as it is a much easier and efficient user experience.

    Details:  There is a commitment out there which states a budget (Parent Record) but the rules dictate that it can be overspent up to a certain threshold.  As the invoice is processed against the commitment within the child record if it falls within that threshold then a new parent record can be established for the difference.

    ------------------------------
    Jeremy Cohen
    ------------------------------



  • 4.  RE: Create a new parent record based on criteria on child record

    Posted 10-17-2019 11:55
    You can create a record by using the API for API_AddRecord, and I can help you with the syntax for that once I understand your work flow.

    You are sitting on a child record.  So via lookups, a child can know any fields from the Parent and they can be used by the API.  So you click and create a parent record and then what?  Where do you want to land the user and does the child you are sitting on need to get attached to the new parent?

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



  • 5.  RE: Create a new parent record based on criteria on child record

    Posted 10-18-2019 13:20
    Hey Mark,

    Sorry for the delayed response.

    I would be sitting in the child record and need to initiate a new parent record.  The two do not need to tie together.  The system I am integrating with through csv reads each change as an individual record so it would be a new line for every addition or subtraction.  The user just needs to initiate the new record being generated.  

    The user will be in the form of the child.  This is why I was leaning towards a url button.  I was just having a hard way to go with how to replicate a parent record associated to the child form and then make a few minor alterations to that record so that it is unique.

    The attachment will happen more external to the system than internal.

    ------------------------------
    Jeremy Cohen
    ------------------------------



  • 6.  RE: Create a new parent record based on criteria on child record

    Posted 10-18-2019 15:36
    If you want to create a parent record and land the user on the patent record, the formula would be

    URLRoot() & "db/" & [_DBID of the Table name from Advanced Properties] 
    & "?act=API_AddRecord"
    & "apptoken=xxxxxxxxxxxx" // you need this line if you have left th3 app to require Application tokens
    & "&_fid_7=" & URLEncode([some text field])
    & "&_fid_8=" & ToText([some numeric field])
    & "&displayrec=1"

     I have put an app in the exchange called URL formulas for dummies which can help you with some of the syntax.     There is also the API guide which describes the different API calls. 






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



  • 7.  RE: Create a new parent record based on criteria on child record

    Posted 10-18-2019 16:00
    Hey Mark,

    That works for just adding a record.  So your saying I should just create lookup fields for every possible field I need when it is related and then use the url to simply add a new record...i guess that would be a much simpler approach to it.

    In that case any fields I'm changing due to the conditional I could just tie directly to the fid....I'll try the approach.  Thank you very much for the help Mark!

    ------------------------------
    Jeremy Cohen
    ------------------------------



  • 8.  RE: Create a new parent record based on criteria on child record

    Posted 10-18-2019 16:03
    Edited by Mark Shnier (Your Quickbase Coach) 10-18-2019 16:04
    Exactly, your initial thinking was way overthinking what was required.  It's just the API to ADD a record and the only complexity is where to land the user after the button is pushed.

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