Link Parent to Child with RunImport

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I have the following tables/relationships:

Estimates < Line Items

Projects < Assignments

When an Estimate is approved, I have a URL button that will run two separate API_RunImports.  Information from the Estimate will get pushed to create a new Project and info from the Line Items will get pushed to  create new Assignments.

I can create the Project from the Estimate fine.  My problem is properly linking the new Assignments to the new Project if a RecordID# has technically not been created yet. 

From my understanding, I have to create a new key field besides the RecordID# on the Project table and then create a formula field on the Assignment table that would force the Project key field in there (or something like that).

I'm just looking for a little guidance/clarification.

Photo of Carlos

Carlos

  • 100 Points 100 badge 2x thumb

Posted 3 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 65,806 Points 50k badge 2x thumb
Yes,  If you knew what the Key field of the project was going to be and entered it manually on the Estimate once it was approved, then you could use that to make a button on the estimate to create the Project and then run the API_RunImport.

You would probably want to lookup down from the hopefully non existent project of a field like [Project exists?] so that you would be sure that the project number was not already in use.  That could be part of the formula.  The field [Project Exists?] on the project record would just be a checkbox formula field set to be true.

Like
var text CreateProject = ......;
var text import Lines =  = ......;

if(not [Project exists?],
$CreateProject
& "&rdr=" &URLEncode($ImportLines)
Photo of Carlos

Carlos

  • 100 Points 100 badge 2x thumb
Thanks for the response Mark.  I'll try to get to it this weekend to see if I can get it to work.