Announcement

Collapse
No announcement yet.

How can I create Lead Entity Relationship By Formula

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

  • How can I create Lead Entity Relationship By Formula

    Hi I need some urgent help is there any body please tell me how can i create relationship with between Lead And Property by using Formula. You can check my code example in attachment




    ifThen($leadnew == true,
    record\create('Contact',
    'firstName', firstName,
    'lastName', lastName,
    'phoneNumber', phoneNumber,
    'emailAddress', emailAddress,
    'selectLeadType', selectLeadType,
    'assignedUserId', '1'
    );

    $createProperty = record\create('RealEstateProperty',
    'addressCity', address2City,
    'addressCountry', 'USA',
    'addressPostalCode', address2PostalCode,
    'addressState', address2State,
    'addressStreet', address2Street,

    'address2City', address2City,
    'address2Country', 'USA',
    'address2Line2', address2Line2,
    'address2PostalCode', address2PostalCode,
    'address2State', address2State,
    'address2Street', address2Street,
    'cityArea', cityArea,

    'assignedUserId', '1'
    );

    );

    record\relate('Lead', '62c18054be7534588', 'realEstateProperties', '62bf075d6a8c0197e');

  • #2
    Hi I need some urgent help is there any body please tell me how can i create relationship with between Lead And Property by using Formula. You can check my code example in attachment

    Originally posted by aliwaqas View Post


    ifThen($leadnew == true,
    record\create('Contact',
    'firstName', firstName,
    'lastName', lastName,
    'phoneNumber', phoneNumber,
    'emailAddress', emailAddress,
    'selectLeadType', selectLeadType,
    'assignedUserId', '1'
    );

    $createProperty = record\create('RealEstateProperty',
    'addressCity', address2City,
    'addressCountry', 'USA',
    'addressPostalCode', address2PostalCode,
    'addressState', address2State,
    'addressStreet', address2Street,

    'address2City', address2City,
    'address2Country', 'USA',
    'address2Line2', address2Line2,
    'address2PostalCode', address2PostalCode,
    'address2State', address2State,
    'address2Street', address2Street,
    'cityArea', cityArea,

    'assignedUserId', '1'
    );

    );

    record\relate('Lead', '62c18054be7534588', 'realEstateProperties', '62bf075d6a8c0197e');

    Comment


    • #3
      Hi aliwaqas,

      Please try to insert this part:

      Code:
      ifThen(
      
      $leadnew == true,
      
      record\create('Contact',
      'firstName', firstName,
      'lastName', lastName,
      'phoneNumber', phoneNumber,
      'emailAddress', emailAddress,
      'selectLeadType', selectLeadType,
      'assignedUserId', '1'
      ) && $createProperty = record\create('RealEstateProperty',
      'addressCity', address2City,
      'addressCountry', 'USA',
      'addressPostalCode', address2PostalCode,
      'addressState', address2State,
      'addressStreet', address2Street,
      'address2City', address2City,
      'address2Country', 'USA',
      'address2Line2', address2Line2,
      'address2PostalCode', address2PostalCode,
      'address2State', address2State,
      'address2Street', address2Street,
      'cityArea', cityArea,
      'assignedUserId', '1')
      
      );
      
      ifThen(
      record\exists('RealEstateProperty', 'id=', $createProperty),
      record\relate('Lead', '62c18054be7534588', 'realEstateProperties', $createProperty)
      );
      Note, please, I made some changes in this code few moments ago.
      Last edited by lazovic; 07-05-2022, 04:05 PM.

      Comment


      • #4
        Great Thanks dear it's working now I just need a little bit more help can you please tell me who can I get the Lead id also. I want to make a Relationship when I submit a new lead entity.

        Comment


        • rabii
          rabii commented
          Editing a comment
          Like below hence the formula is within the lead entity the system will pick up the lead id.

          Code:
          record\relate('Lead', 'id', 'realEstateProperties', $createProperty)

          if it doesn't work try it like below without quotes:

          Code:
          record\relate('Lead', id, 'realEstateProperties', $createProperty)

      • #5
        aliwaqas,

        Always glad to help you, you’re welcome.

        Tell me what exactly do you mean? What relationships need to be established, after what actions, between which Entities? Should this be implemented in the formula above or create a formula for a different Entity?
        Please tell more.

        Comment


        • #6
          Dear @Iazovic if I submit the Lead Entity Form I also need the id of the submitted form. Which I can use in Property Relationship Formula

          record\relate('Lead', 'LeadID', 'realEstateProperties', $createProperty) );
          In a short word please tell me how can I get Summited entity form id in Formula
          Thanks in advance
          Last edited by aliwaqas; 07-06-2022, 05:18 PM.

          Comment


          • #7
            aliwaqas,

            As far as I understand, this formula should solve your question:
            Code:
            $leadId = entity\attribute('id');
            
            ifThen(
            record\exists('RealEstateProperty', 'id=', $createProperty),
            record\relate('Lead', $leadId, 'realEstateProperties', $createProperty)
            );

            Comment

            Working...
            X