Announcement

Collapse
No announcement yet.

How to fetch related record by formula

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

  • How to fetch related record by formula

    Hello. It is quite easy question, but I am doing something wrong.
    Relation: Task -> oportunity (OneToOne Left) -> Oportunity

    the string
    Code:
    findRelatedOne('Task', taskId, 'opportunity');
    don't returns anything as if there are syntax error.

    Please, open my eyes.​

  • #2
    chinas,

    In your case (when the One-to-One Left relation is used), opportunityId will be enough. For example:

    Code:
    $test = opportunityId;
    description = $test;​
    Thus, id of the associated opportunity will appear in the description field of the task. This formula must be used in Administration > Entity Manager > Task > Before Save Custom Script > Formula.

    Comment


    • #3
      Unfortunatelly your technique don't work as well.
      I am using formula in Workflow functionality of WorkOut entity at AfterCreation Event.
      The target is copying ForeignLink from "Task.opportunity relation record" to "WorkOut.opportunity record".
      So "opportunityId" not exists at the monent.​

      Comment


      • #4
        Does Task has any relationship with WorkOut entity ? Also what is the relationship between WorkOut and Opportunity ?

        findRelatedOne is destined for has-many and many-to-many relationships

        > Relation: Task -> opportunity (OneToOne Left) -> Opportunity

        If this is your set up definitely there is an opportunityId (Or what is the name you named that relationship)

        JFY there is no such task.opportunity a Task is a child to different entity types amongst them the opportunity so i order to get the opportunity of a task you need to access the parent field.
        Last edited by rabii; 11-16-2023, 10:22 AM.

        Comment

        Working...
        X