Forum Discussion

IvanWeiss's avatar
IvanWeiss
Qrew Captain
5 years ago

Restructuring Task Table Broke all my API Buttons, Not sure how to fix

I recently corrected my tasks table.  It used to have a List User Field for Assigned To so that I could easily assign tasks and create API buttons to be able to create tasks from my "Opportunities" Table (other places as well).

Some users reported they needed a feature so that they could see all of the tasks their team employees were working on.  So I had to restructure this table so that now I have a departments table with a List User Manager field (sometimes we have more than one manager) and be able to pass that data around to generate the report.  Just got that working, phew.  With a lot of help from the community.

Now, I have my first button I am trying to fix.  Here is the code:

URLRoot() & "db/" & [_DBID_TASKS] & "?a=API_GenAddRecordForm&_fid_12=" & URLEncode ([Record ID#])& 
"&_fid_6=" & URLEncode("Standard Design Proposal") &
"&_fid_8=" & URLEncode(Today()) & 
"&_fid_12=" & [Record ID#] & 
"&_fid_21=" & [Project] &
"&_fid_23=" & "Opportunity" &
"&_fid_28=" & "Opportunity" &
"&_fid_31=" & "mmattera@elitestudioe.com" &
"&z=" & Rurl()

I need to replace the fid31 line.  Somehow I need to create a record in my task assignees table that relates back to this task.  The problem is until this record is saved I dont know its record ID.  So I am not quire sure how to add anything in the join table (Tasks has many Task Assignees, Task Assignees as many Team Members).

16 Replies

  • When you click this button where are you sitting and what type of record are you trying to create.
    • IvanWeiss's avatar
      IvanWeiss
      Qrew Captain
      I am sitting on the Opportunities table.  I have a series of buttons that all automatically create tasks (some stacked and some not) based on the request.  In this first example we are requesting a Design Proposal for the opportunity.  The logic is:

      • Create a task to Create Design Proposal
      •   This task is assigned to MaryEllen (our design director)
      •   It also sets some other paramaters such as due date, title, etc.

      The app structure is:
      Tasks Have many Task Assignees
      Task Assignees have many Team Members

      So I think I need to stack another URL to create a task assignee and link the record ID of Team Member to MaryEllen.  I get that side.  But how do I in that same URL link the record ID of Task to the new task I just created in the first URL?
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      you can't. you need to create the Task, then that task will have a button to assign the Team member by making an Assignee record.  Set the Task Table to auto save when a child is created.
    • IvanWeiss's avatar
      IvanWeiss
      Qrew Captain
      My Quickbase support person through orientation came up with a good workaround.  We hid the Assigned To field (the old one) and setup an automation so that when that field is populated it triggers an automation to create a new record and copy the assigned to values.  That works :)

      Now the next issue it creates is when the GenAddRecordForm runs it shows the form with a blank assignees form.  I know my users would populate that not knowing the automation is going to run behind it.  I think I need to make it a AddRecord to eliminate that.  however, is there a way to display the newly created record?  Otherwise they just have ot manually think to edit it if they need more details
  • Congrats on correcting the task, Ivan. 

    Before you invest more time in building API buttons, I'd encourage you to step-back and review your application design.  Grab a sheet of paper (or use the tools in QuickBase).  Draw a rectangle for each table.  Draw an arrow to represent each relationship (point it toward the child table).  This picture is called an application diagram.

    Review the diagram with an experienced app. builder.  Mark Shnier is great; CloudBase Services will spend an hour with you gratis.  If you have a good design, building the app. will be easier and faster than if you have extra table OR bad relationships.

    Writing API buttons is the equivalent to running water lines.  It's only worth doing once you are absolutely certain where you want the faucet.  So, find yourself a great architect and map out your 'building.'
    • IvanWeiss's avatar
      IvanWeiss
      Qrew Captain
      Debbie, I could not agree more that a strong app diagram would be very helpful.  I was using the built in tool and started to create one but honestly it got a bit complicated.  I have a subscription to LucidChart so I was going to document it there but as complicated as it is now with quite a few tables I thought might be best to just leave it to the app tool to maintain.  But might be better to go a 3rd party route.

      Any suggestions to a good tool or method for a relatively larger app?  I probably have more than 20 tables at this point and it is still climbing.  I am about to start building out order management functionality too so that is only going to further complicate it.
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      imho, the in app tool is the best idea as it's always up to date.  

      Uncheck the "Show Reference fields" to reduce clutter.  When the tale pop up window smacks you in the face enough times when dragging the boxes around, you will learn to drag it out of the way to a bottom corner (neither of those "stick" so you will have to do them again when you come back to the diagram.

      Consider putting a link to the Relationship Diagram page on an Admin dashboard while you are building the app. it will save you a few clicks.

      20 tables is not a lot for that tool and 20 tables is not that unusual for a Quick Base app.
    • IvanWeiss's avatar
      IvanWeiss
      Qrew Captain
      Thanks Mark, that is a great idea to put a link on an admin page.  I did learn the trick on moving the box to the corner which is a HUGE advantage.

      I am about to start building out order management functionality so I know that number is going to still grow quite a bit.  I would be surprised if I land in the 30-40 range.