4 Replies Latest reply on Oct 17, 2016 8:09 AM by simacit

    Use fields from a relationship without copying in object

    simacit Apprentice

      Hello

       

      I trying to populate a task assignment notification with the owners displayname. The only field available in the Task object is the Owner (loginID).

       

      One way would be to create an additional field in the Task object and populate it with the owners Displayname.

       

      But is it not possible to use the excisting relation between Task and Employee? We have the RecId of the Employee in the field Owner_Valid. But I've no idea what syntax to use in the expression editor to get the displayname of that relationship.

       

      Can someone help me

       

      Thanks in advance

        • 1. Re: Use fields from a relationship without copying in object
          florian1 Expert

          Hi Simac,

           

          If you only need to display a field from the Employee object, there are several ways to achieve this.

          I prefer using the EvalField() function in this case:

           

          $(EvalField("Employee#", Owner_Valid, "DisplayName"))
          
          

           

           

          Cheers,

          Florian

          1 of 1 people found this helpful
          • 2. Re: Use fields from a relationship without copying in object
            simacit Apprentice

            Hi Florian

             

            Thanks for this solution. Can you learn this somehow or is this just a result of a lot of experience?

            However, great tip, great product!

             

            Cheers

            René

            • 3. Re: Use fields from a relationship without copying in object
              daveb1 Apprentice

              Hi Rene,

               

              Normally is this case you would use the relationship between the two business objects, but there isn't a formal relationship between Task.Assignment and Employee that uses the Owner field.  There are two other relationships between these objects but they don't use the field you are interested in lookup up.

               

              You could create a relationship between them and use the Owner field in Task.Assignment equal to LoginId in employee.  However this would be subject to problems if an employee's LoginId can change.  However, if the new relationship's name was 'TaskAssignmentAssocEmployee' then you could use the expression: [Employee#.TaskAssignmentAssocEmployee]DisplayName to reference the Task.Assignment Owner's DisplayName.

               

              Another way to do lookups is through the use of Link fields.  There is a field called OwnerLink on Task.Assignment, but it does not appear to be used.  But, if it were populated with values, you could use the syntax: [link:OwnerLink]DisplayName

               

              Check out the help page titled 'Using Field References' (end of the URL is /help/admin/index.html#reference/expressions/field_references.htm) for more info.  It contains information on absolute references (rather than the normal relative references) and the ability to reference the value of a field before the current transaction using the :orginal specifier.

               

              Cheers,

              David

              • 4. Re: Use fields from a relationship without copying in object
                simacit Apprentice

                Hi David

                 

                thanks for your comment, I will certainly check the Help pages you indicated.

                 

                Cheers

                René