Forum Discussion

JackWoods's avatar
JackWoods
Qrew Trainee
5 years ago

Auto-populate Project Name when adding Document from Task

Hey Quick Base Community!

I'm new to the program and community so I hope I'm posting this in the correct place :) 

I need to modify the "Add Document" button on the task form so that it not only auto populates not only the Task name on the Document record but also the related project name as the relationship is already established. Below is the current formula in the "Add Documents Fields" on the Task table.

URLRoot() & "db/" & [_DBID_DOCUMENT_LIBRARY] & "?a=API_GenAddRecordForm&_fid_58=" & URLEncode ([Task ID])& "&z=" & Rurl()

I also see that the formula highlights the "Related Task #" on the document table in the formula. The "Related Project #" is 37. i imagine the formula will include this as well. 


Could you please help me update this formula to "Add Documents" so this functions properly and doesn't cause confusion among my users.


Peace and Love!
ā€‹ā€‹

------------------------------
Jack Woods
------------------------------
  • Welcome to he Community.  We are very friendly here.

    so np,

    Try this

    URLRoot() & "db/" & [_DBID_DOCUMENT_LIBRARY] & "?a=API_GenAddRecordForm"
    & "&_fid_58=" & URLEncode ([Task ID])
    & "&_fid_37=" & [Related Project]
    & "&z=" & Rurl()

    The first line say to go to your Realm (like mycompany.quickbase.com" and then to a particular Table and call the API which will put up a data entry form, to add a record.
    The next line says to stuff the Task ID, which is key field of your Tasks table into field id 58.  That would be the field  in Documents for [Related Task]

    The next line which is the new line you will add says that assuming that in the documents table the field for [Related Project] is field ID 37, we stuff the value of [Related Project] of the Task also into the  [Related Project] field in documents.

    The last line says to land the user back where they started on the Task Record after saving the document.

    Note that I broke up your code into 4 lines for better readability.  The & at the start of each line is just for concatenation.  The &s inside the quotes tells Quick Base that a parameter is about to follow.  So same character but completely different meaning if it is outside the quotes (concatenation) or inside the quotes.

    There is an app I put in the Exchange called URL Formulas For Dummies which explains some of the basic syntax of these URL formula buttons.

    see you around .......

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • JackWoods's avatar
      JackWoods
      Qrew Trainee
      Thank you so much! this worked perfectly. 

      I had to change the name of the field from "Related Project" to "Project ID" - works like a charm now.

      Thank you for the breakdown on how to read to code as well - very helpful. 

      have a good one,

      ------------------------------
      Jack Woods
      ------------------------------