Forum Discussion

MattMakris's avatar
MattMakris
Qrew Cadet
5 years ago

QB Action that creates a related record in another table when new record saved.

In our CRM we have the ability to "attach" documents to other types of records such as "client activities". In order to have the ability to related several records to one document, we use the following data storage topology:

Table: "Documents" - this is where we store actual document file, description, etc.
Table: "Document Selections" - this is where we store the relationship between a record in other tables to the document record in the "Documents" table.
Table: "Activites" - this is the table we use in our CRM to log interactions with clients. Users also have the ability to attach/relate an existing document record in the "Documents" table to the Activity record OR have the option to add a NEW Document record that would relate to the Activity record. 

My issue is that the current process for creating a new Document requires the user to select the "Related Document" dropdown and scroll all the way to the bottom of the dropdown list to select the "+ Add New Document" option. From here, they open yet another window/screen to upload the document. By now, they have been presented with three different forms. 

My attempt at a solution was to add fields to the "Document Selections" form that would allow the user to upload a file and two other fields that mimic that of the "Documents" table. I've been trying to create an action that would copy these fields to the "Documents" table, which works, but does not then write the "Documents" `Record ID #` to the `Related Document` field back to the original "Document Selections" record that triggered the action originally. I tried creating a similar action in the "Documents" table that looked for a new "Documents" record with a static numeric field called "Related Document Selection (static)" that contains the `Record ID #` of the original "Document Selections" record that was created, however, this ends up creating a NEW "Document Selections" record, rather than updating the current record.

Any help on this would be much appreciated, thank you!!

​​​​

------------------------------
Matt Makris
------------------------------

5 Replies

  • DonLarson's avatar
    DonLarson
    Qrew Commander
    Matt,

    Is this your architecture?  I made up additional table names as parents of the Document Selections.


    If this ERD is wrong, then please correct me.

    Without knowing more about your business case, I would change design so that the Documents table is related directly to the other Business Objects: Tasks, Opportunities ......



    Now in each Parent Table you can modify the Add Document Button to take your Users to a specific form to add the Document for what ever your business rules require.

    If the Document record needs to be related to an additional Parent in the future, you can have another QB Form that drives that process.

    This should solve the issue in your question but there will be more things popping up for Document management.
     





    ------------------------------
    Don Larson
    Paasporter
    Westlake OH
    ------------------------------
    • MattMakris's avatar
      MattMakris
      Qrew Cadet
      Hi @Don Larson​,

      You nailed the data architecture (1st diagram). The reason we designed it this way is so you can 'attach' multiple documents to another record, such as an activity, while having the ability to 'attach' existing documents that records in other tables are linked to, so that we don't have to re-upload duplicate documents. For instance, if an Opportunity is linked to a proposal document and a contract document, I'd also like to link a task to those same documents. This way we aren't loading our database up with duplicate files and we're able to link multiple documents to single records..

      ------------------------------
      Matt Makris
      ------------------------------
      • DonLarson's avatar
        DonLarson
        Qrew Commander
        Matt,

        I got lucky on the diagram so now let me make sure I understand the work flow problem with this architecture.

        Is the User issue adding a New Document and Document Selection  OR

        is the problem adding a Document to an existing Document Selection that is already related to the Activity?

        ------------------------------
        Don Larson
        Paasporter
        Westlake OH
        ------------------------------