Announcement

Collapse
No announcement yet.

record\create for fields of type Link

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

  • record\create for fields of type Link

    I am using 2 workflows: one to create a unique Account (if it doesn't exist) from a lead and another to create a unique Contact from that same Lead

    The fields Accounts, Account, and Account Title (Accounts is a combination of Account -> Accounts Title)
    in Contact are not being filled from that Lead (using the formula below) but other fields like firstName are being filled properly.

    Code:
    // This formula creates a Contact if no contact with the same name exists
    $memberId = record\findOne('Contact', 'createdAt', 'desc', 'name=', name);
    ifThen(
        $memberId == null,
        record\create('Contact', 'name', name, 'accounts', accounts, 'account', accountName, 'title',title)
        );
    Any ideas on how to solve this are highly appreciated.

    ** In simpler words, I would like the Contact to be created from the Lead and have the Lead's Accounts (Account -> Title) like when you click Convert.
    Last edited by JosNas; 11-02-2021, 03:19 PM.

  • #2
    Bumping this^

    Comment


    • #3
      Hi JosNas,

      Code:
      $memberId = record\findOne('Contact', 'createdAt', 'desc', 'firstName=', firstName, 'lastName=', lastName);
      $firstName = entity\attribute('firstName');
      $lastName = entity\attribute('lastName');
      $accountName = entity\attribute('accountName');
      ifThen(
      $memberId == null,
      record\create('Contact', 'firstName', $firstName, 'lastName', $lastName, 'description', $accountName)
      );
      In this case, the "accountName" field of the target entity (e.g. Lead), will be recorded in the "description" field of the Contact entity.
      You can create a new one custom varchar-type or text-type field for this.

      Comment


      • #4
        Hello again Vadym and sorry for bothering you. As helpful as this was, this isn't what I'm trying to do.

        When a contact is created, there is a field called account (not custom) that connects to a record existing in Account Entity and next to it appears his title in that account. Kindly Check the attachment below to see it.

        Using the formula, I'm trying to copy the values filled in Lead Entity (accountName & title) to the Contact Entity (account & title) without having to manually assign them
        Attached Files

        Comment


        • #5
          Hi JosNas,

          "accounts" field of Contact Entity is a Link Multiple-type field.
          "accountName" field of Lead Entity is a Varchar-type field.

          So you have to create a custom Varchar-type or Text-type field for storing "accountName" field data into Contact Entity (Administration -> Entity Manager -> Contact).
          After you have to put this field on layouts (Administration -> Layout Manager).

          The code above you can use in Workflow (for Lead target entity with Execute Formula Script action) or fill Formula of the Lead entity (Administration -> Entity Manager -> Lead).

          Also, you have to change the 'description' field in the formula above to your custom Varchar-type or Text-type field.

          Comment

          Working...
          X