Formulas: Get Related Entity's Phone Number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tobias
    Senior Member
    • May 2016
    • 229

    Formulas: Get Related Entity's Phone Number

    Hi there,

    we've set up a workflow to create a Call (Related Record) whenever a new Lead (Target Entity) is created (see screenshot attached).

    The new call should have a short description, including the Lead's phone number. To achieve that, we used the following formula for the new related record:
    Code:
    short_description=string\concatenate(targetEntity\attribute('first_name'), " ", targetEntity\attribute('last_name'), " - phone number: ", targetEntity\attribute('phone_number.name'));
    Using phone_number.name was a best guess that didn't work.

    Any suggestions?
  • yuri
    Member
    • Mar 2014
    • 8453

    #2
    Hi,

    Did you try targetEntity\attribute('phoneNumber') ?
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • tobias
      Senior Member
      • May 2016
      • 229

      #3
      Yes, I tried:
      Code:
      parent_id=targetEntity\attribute('id');
      short_description=targetEntity\attribute('phoneNumber');
      Also,
      Code:
      parent_id
      isn't working either.

      Any other ideas?

      Here's the current setup:

      Click image for larger version

Name:	espo_workflow_setup.png
Views:	298
Size:	110.9 KB
ID:	32847
      Last edited by tobias; 11-30-2017, 07:35 PM.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8453

        #4
        Maybe you should try:

        parentId = targetEntity\attribute('id');
        shortDescription = targetEntity\attribute('phoneNumber');

        .
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • tobias
          Senior Member
          • May 2016
          • 229

          #5
          Perfect, that did the trick

          Note that we as well had to set parentType = 'Lead'.

          The final code reads:

          Code:
          parentId = targetEntity\attribute('id');
          parentType = 'Lead';
          shortDescription = string\concatenate(targetEntity\attribute('firstName'), " ", targetEntity\attribute('lastName'), " - phone number: ", targetEntity\attribute('phoneNumber'));

          Comment

          Working...