Announcement

Collapse
No announcement yet.

Autofill of matched data after relating an Entity

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

  • Autofill of matched data after relating an Entity

    Is there any triggers or hooks that could be triggered after selecting an Entity through selection? This is to let me autofill the data from the selected entity fields' to the current entity edit form.

    I was thinking that it could be the afterRelate() method or through the custom views.

    Please let me know the right path to do the functionality.

    Thank you!

  • #2
    Hello
    Yes, there are hooks afterRelate and afterUnrelate.
    https://www.espocrm.com/documentatio...lopment/hooks/

    Comment


    • #3
      Thank you for the response.

      Yes, I tried using afterRelate() method but its not executing the function.

      For example, I made a custom hook under /custom/Espo/Custom/Hooks/Project/Description.php

      This hook is not executing after I try to relate an Account to a Project entity.

      Comment


      • #4
        application/Espo/Hooks/Common/Stream.php - there is an example
        you don't save modification

        and what is the relationship type?

        Comment


        • #5
          Many Project, One Account.

          I want to map the data from an Account to the Project after selecting an Account through relation.

          The afterRelate() is only working on the Documents entity wherein I link documents since their relationship is Many Documents with One Project. (opposite of account)

          Is there a way I could do this on the other way around?

          Thank you!

          Comment


          • #6
            Hello
            afetrSave hook for project. And check if ($entity->isFieldChanged('accountId'))

            Comment


            • #7
              Thanks! This is what I am looking for.

              Thank you for the support.

              Comment

              Working...
              X