Announcement

Collapse
No announcement yet.

To link parent record

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

  • To link parent record

    Hello.
    I want to link an Email record to an Opportunity record via parent relation (parent field in Email).
    I use this function in Opportunity Formula (Before Save Custom Script):

    Code:
    $EmailID='5ec8db83df7db257';
    $ThisId=id;
    record\relate('Email', $EmailID,
      'parentType', 'Opportunity' ,
      'parentId', $ThisId
    );
    But it doesn't work. What's wrong?
    Thank you.

  • #2
    One of my guess is it will only work on Email with the ID 5ec8db83df7db2?

    Not sure where your formula is getting the Opportunity ID either, is it parentId? But if it already is a Parent why would you link it again?

    Email is quite restrictive at the moment.
    With that said, this formula too high level for me, can't help.

    Comment


    • #3
      Opportunity is a record, which runs the formula in Before Save Custom Script. So its ID is got by $ThisId=id.
      $EmailID is ID of the Email record, in which I try to put the processed Opportunity record in its field 'parent'.

      Comment


      • esforim
        esforim commented
        Editing a comment
        I see, still can't help you with my skill level.

        But food for thought, have you tried basic formula yet? See if it actually work in the first place (at all) before using a complex formula. For example it can just be something simple like:

        {{description}} = {{email.Name}}
        (wrote this formula on top of head, i don't think field name is right)

    • #4
      I think you can just assign the value in formula. parentID='something'

      Comment


      • Oleksii S.
        Oleksii S. commented
        Editing a comment
        The Parent field, which has to be edited, is outside the context of the Opportunity script, thus should be set by record\attribute function.
        What me confuse at the topic is failure of above 'record\relate'.

    • #5
      about relate failure the proper syntax in formula should be 4 string parameters like this example: record\relate('Account', $accountId, 'opportunities', $opportunityId)

      Comment

      Working...
      X