Lead capture variable to comment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grej
    Junior Member
    • Feb 2024
    • 13

    Lead capture variable to comment

    Good day,
    I am currently got fully functioning integration (Web to Lead), where one variable is stored in Description. Is it possible to store data in First Comment, rather than in the variable description.

    Hope I have expressed myself clear
  • lazovic
    Super Moderator
    • Jan 2022
    • 809

    #2
    Hi grej,

    Please tell me is the First Comment your custom field in the Lead entity? Or do you mean the first post in the Lead's stream?

    Comment

    • grej
      Junior Member
      • Feb 2024
      • 13

      #3
      Hello lazovic

      Thank you for your clarification.

      Indeed, I was referring to the first post in the Lead's stream. I appreciate your attention to detail and assistance in this matter.

      I have an idea that it should be made via beforeSave hook, which I am already experienced in, but Stream is not an Entity, that's where I have stuck

      Warm regards,
      ​grej
      Last edited by grej; 02-27-2024, 06:46 PM.

      Comment

      • lazovic
        Super Moderator
        • Jan 2022
        • 809

        #4
        grej,

        It is best to create a separate field to accept the value that you are currently writing to the Description field. You can create a First Comment text field in the Lead entity.

        Next, you should use a workflow (Advanced Pack extension feature). We should be guided by the fact that we need to create a post in the stream when a lead is created through Lead Capture. Therefore, let’s add the Lead Capture option to the list of options in the Source field in Lead entity, and then select this option in Lead Capture itself.

        Next, it remains to create the workflow itself, with Lead target entity, which will be triggered after the lead is created, with "Source equals Lead Capture” condition. Let's add an action to the actions of this workflow to create the note itself in the stream, as it shown on the screenshot:

        Click image for larger version

Name:	image.png
Views:	212
Size:	26.2 KB
ID:	103138

        Full workflow screenshot:

        Click image for larger version

Name:	image.png
Views:	148
Size:	50.6 KB
ID:	103139

        Please let me know if you have any additional questions or encounter any difficulties with this solution.​​​

        Comment

        • grej
          Junior Member
          • Feb 2024
          • 13

          #5
          lazovic

          Thanks for your suggestion! I'm helping a friend out, and we're trying to keep costs down, so we're looking for a workaround that doesn't involve paid features. Do you have any advice on how we might achieve this without the Advanced Pack? Appreciate your help!

          Comment

          • lazovic
            Super Moderator
            • Jan 2022
            • 809

            #6
            grej,

            You can go to Administration > Entity Manager > Lead > Formula > Before Save Custom Script and paste the following formula script:
            Code:
            if (entity\isNew() && source == 'Lead Capture') {
                record\create('Note',
                              'parentId', id,
                              'parentType', 'Lead',
                              'type', 'Post',
                              'post', firstComment
                              )
            }


            More about formula script in EspoCRM you can find here: https://docs.espocrm.com/administration/formula.

            Comment

            • grej
              Junior Member
              • Feb 2024
              • 13

              #7
              lazovic

              Just wanted to drop a quick note to say a huge thanks for your help with the EspoCRM formula stuff. Your explanation was spot on and exactly what I needed. I tried it out, and everything worked perfectly!

              It's awesome to have people like you around who are willing to share their knowledge. Really made my day easier. Looking forward to returning the favor sometime.

              Thanks a ton!

              Comment

              • grej
                Junior Member
                • Feb 2024
                • 13

                #8
                code:

                PHP Code:
                if (entity\isNew() ) {
                record\create('Note',
                'parentId', id,
                'parentType', 'Lead',
                'type', 'Post',
                'post', description
                )
                }

                Comment

                Working...