Announcement

Collapse
No announcement yet.

relations between document, account and opportunity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • relations between document, account and opportunity

    I have a problem and can't find an approach to solve it. Maybe the forum can help me.

    In Espo there are the following relations for documents:

    documents n:n accounts
    documents n:n contacts
    documents n:1 folder
    documents n:n leads
    documents n:n opportunities

    If I now create an opportunity under an account and attach a document to this opportunity, this document is not displayed with the account. When I look at the document, I see that it is linked to the opportunity, but not to the account.
    The same happens for documents I assign to a contact in an account, they are not automatically assigned to the account either.

    If I add the document directly to the account, it will also be linked to it.

    Since automatic linking via opportunities / contacts used to work, I'm wondering if this is a general bug or if I made something wrong?
    Any help would be appreciated.

  • #2
    That seems not to be a bug. For self designed / additional relations created by the Espo-admin there is no PHP Code to set those links. But I am pretty sure you are able to assign the account that is assigned to the opportunity with a formula / BPM workflow.

    Here some thoughts about that:
    ---------
    accountsIds = accounts1Ids; // we have more than one link for accounts
    accountsNames = accounts1Names; // we have more than one link for accounts

    // Fill readonly field for better search (string)
    // Put linked accounts in a string

    descriptionsearch=' '; // descriptionsearch is a user defined field
    $data = list();
    $data1 = list();
    $i = 0;
    while($i < array\length(accounts1Ids),
    (
    $id = array\at(accounts1Ids, $i);

    $data1 = record\attribute('Account', $id, 'name');

    $data = array\push($data, $data1);
    $i = $i + 1;
    )
    );
    descriptionsearch=array\join($data, '\n');
    -----------


    Or like that (this is an example for contacts, must be redesigned for your needs):

    -----------
    ifThen(parentType == "Opportunity" ,
    parentcaseType = "Contact"; //parentcasetype is a user defined field
    $contactId = record\attribute("Opportunity", parentId, "contactId");
    $contactName = record\attribute("Opportunity", parentId, "contactName");
    parentcaseId=$contactId; // parentcaseId is a user defined field
    parentcaseName=$contactName; // parentcaseName is a user defined field
    );
    ----------
    If there is more than one relation you should use record\findRelatedMany
    But then you have to handle an array, not a string​

    Comment


    • #3
      Hi there,

      thanks for your reply but this is not what I meant.

      My problem is that it was still working at the beginning of the year (2022). I could add a document to an account and it was automatically linked to the account associated with the opportunity. Since some time this does not work anymore. There is also no way to subsequently link a document to an account or contact. I have followed this in the espoCRM demo, there it also does not work (anymore).

      My question here would be, if this is a bug or intentionally changed, that you can only link a document to one entity?

      For me it would be very useful if it works like it used to. If it is no longer desired to link automatically, it would be good to have a way to add fields to the document entity where you manually add the account (or even contacts or opportunities, etc.).

      Comment


      • #4
        Hi,

        you maybe right. Because of we had to implement from the beginning on more than one link, because of sub-pages (via Report Panels) must be shown in different layouts (where the same foreign entity is linked). With Link only to one field that is not possible.
        So I never asked myself the question if this kind of "double automatic link" is possible.​​

        Comment

        Working...
        X