Create Opportunity from email - problem with field 'Contact'

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • LuckyLouie
    commented on 's reply
    Now It works! Thank You for help Maximus!

  • Maximus
    replied
    Hi,
    I've debugged it and found the issue.
    The link-multiple name to Contact entity is 'contacts'. Please change entity\addLinkMultipleId('contact', $ids); toentity\addLinkMultipleId('contacts', $ids);
    Last edited by Maximus; 03-29-2021, 04:42 PM.

    Leave a comment:


  • LuckyLouie
    replied
    Something's still wrong, Contacts are still not linked to Opportuity. My workflow looks like attached. What I doing wrong?

    Leave a comment:


  • Maximus
    replied
    Hi,
    Should be something like this:
    PHP Code:
    $ids = record\findOne('Contact', 'createdAt', 'desc', 'emailAddress=', targetEntity\attribute('from'));
    entity\addLinkMultipleId('contact', $ids); 
    
    targetEntity\attribute() - formula to retrieve attribute from the target entity of Workflow. In your case it is Email.

    'from' - field that should contain a 'From' email address. If it won't work you can try 'fromAddress' instead.

    entity\addLinkMultipleId('contact', $ids); - link name should starts from lowercase.

    Leave a comment:


  • LuckyLouie
    replied
    Originally posted by Maximus
    Hello,
    I think it's not a bug. There's a hard logic behind the scene.
    Try to use Formula here to fetch a Contact ID and then add it to the Contacts link-multiple field.
    - To get users ID try to use the 'record\findOne' function https://docs.espocrm.com/administrat...#recordfindone
    - To add the fetched contact ID to the Contacts field try to use the entity\addLinkMultipleId function https://docs.espocrm.com/administrat...linkmultipleid.


    Thank you Maximus for the answer. Could you give more information on how to use the record \ findOne function to capture ContactID from email?

    PHP Code:
    $ids = record\findOne(???)
    entity\addLinkMultipleId('Contact', $ids); 
    

    Leave a comment:


  • Maximus
    replied
    Hello,
    I think it's not a bug. There's a hard logic behind the scene.
    Try to use Formula here to fetch a Contact ID and then add it to the Contacts link-multiple field.
    - To get users ID try to use the 'record\findOne' function https://docs.espocrm.com/administrat...#recordfindone
    - To add the fetched contact ID to the Contacts field try to use the entity\addLinkMultipleId function https://docs.espocrm.com/administrat...linkmultipleid.



    Leave a comment:


  • Create Opportunity from email - problem with field 'Contact'

    Hello,
    I would like to create Opportunity when I get new email on specified email adress.
    I relete Many-to-Many email with Contact and create attached workflow for email (after create).
    Name, Account, Description are coppied correctly. I habe problem with field Contact. Why Contact form email can't be coppied to Conntact in Opportunity? It is bug?
    Thank you for any help.

Working...