Announcement

Collapse
No announcement yet.

Prefill field with value of former record

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

  • Prefill field with value of former record

    Is it possible to prefill a field of an entity with a value of another of the previous record?

    For example: In entity "custom1" there are the fields "field1", "field2", "field3". When adding a new record "field2" should be prefilled with the value of "field3" from the previous entered record.

  • #2
    Hello
    if you want to prefill, but not set the value after record saved, you need to develop it.
    if after record saved set is good for you and If records (previous and current) are related, you can do it only with formula or with workflow.

    Comment


    • #3
      Hi Tanya,

      thank you. It would be better to prefill the field so you can see it when the new record is entered, but I´m not a developer ;-) and so I´m not sure how to do this.

      So I have to go the other way. And in that case: How do I relate two records?

      Comment


      • #4
        You can create a Relationship in Entity Manager https://www.espocrm.com/video/entity-manager/

        Comment


        • #5
          Thats true. But can I relate to the same entity? Related to itself? I thought it must be a foreign one.

          Comment


          • #6
            Yes, foreign entity could be the same as target entity. For example, the task could have subtasks. You can implement it with Relationships.

            Comment


            • #7
              Thanks again. I´ll give it a try

              Comment


              • #8
                Now I´ve worked one week but didn´t get this running. My thoughts were this: Reference the field of the related entity with linkName.attributeName
                But how do this get the right value from the last record? Do I have to add some SQL-statement?

                Comment


                • #9
                  Better to search data with ORM https://www.espocrm.com/documentatio...r-content-find
                  What is done and where did you stop?

                  Comment


                  • #10
                    Okay, I´ve created a relation between "Fahrtenbuch" entity and itself and then entered
                    anfangskm=$entityManager->getRepository('Fahrtenbuch')->limit(0, 10)->order('endkm', true)->find();

                    But that doesn´t work. I´m not sure if ORM commands could be entered in formula??

                    Comment


                    • #11
                      No, formula-language has a limited functionality, described here https://www.espocrm.com/documentatio...ation/formula/
                      You can use in related record field, but you can not find any other record....

                      Comment

                      Working...
                      X