Add a Link with parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aysal
    Junior Member
    • Nov 2023
    • 11

    Add a Link with parameters

    I would like to create a button or link in the detailed lead view in EspoCRM that redirects to another page while passing lead data (e.g., email, name, etc.) as URL parameters. Specifically, I want to link to a booking tool where certain fields, such as email and name, are pre-filled via URL parameters. How can I create such a button or text link and embed the required parameters into the URL?
  • ChrisSka83
    Senior Member
    • Apr 2023
    • 197

    #2
    I think this could be achieved with the Kharg extension.
    Hello Everyone, Today I am releasing a new extension: Link Button This extension enhances EspoCRM by introducing a button field that can store URLs and execute multiple actions, including: Open the URL in a new browser tab. Displaying the URL content within a popup window. Embedding the URL content inside an Espo Modal.


    Simply fill this link button with a formula and the parameters are transferred to the other page.​

    Comment


    • Kharg
      Kharg commented
      Editing a comment
      Nice extension, I recommend it as well
  • aysal
    Junior Member
    • Nov 2023
    • 11

    #3
    Thx - i installed the plugin and was able to create a button and also to insert a link. But what do you meant with formula? How can i append lets say the email as a parameter to the url?

    Comment

  • aysal
    Junior Member
    • Nov 2023
    • 11

    #4
    Thx - but i still dont know what to do. Also i dont know where to put this new string into so that it is in every button?

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1602

      #5
      You have to "tell" the link everything, that you want to insert as the link and parameters. The parameter for opening the users e-mail client is href="mailto:contact@yourdomain.com", what means that you will have to build the whole string for the link with a formula (string\concatenate). How to do that is described in the documentation, it is easy.
      Then you create the button and place it in your detail view of the respective entity. After that you will have to re-calculate all records, where the button should appear. This way the button should open the link as you wish.
      If you still have problems, post the link with parameters, which you want to attach to the button, we can have a look and help.​

      Comment

      • aysal
        Junior Member
        • Nov 2023
        • 11

        #6
        Thx - but i am a little confused. Actually the button is created and a url is added - but so far i havent used any formula to add the parameters. Lets say the url is "https://domain.com?firstname=<Firstname>;Lastname=<lastnam e>,email=<email>" How could i create that?

        Comment

        • aysal
          Junior Member
          • Nov 2023
          • 11

          #7
          Thx - i put in my correct link and the parameters, but i still have a problem. Where do i put this php code to? I put it in Standard, but then the PHP-Code is as link in the button and not the gererated String - that throws an error if i want to save a new created link

          Comment

          • ChrisSka83
            Senior Member
            • Apr 2023
            • 197

            #8
            No, completely wrong.

            #Admin/entityManager -> then your desired entity
            -> formula -> custom script before saving.

            Enter the formula there. Save.
            Then go to the frontend, select your entry that should receive this formula.
            In the actions drop-down menu above it, select -> Recalculate formula.​

            Comment

            • aysal
              Junior Member
              • Nov 2023
              • 11

              #9
              THx a lot - but after doing it the field just says "None"


              Comment


              • ChrisSka83
                ChrisSka83 commented
                Editing a comment
                Recalculate formula?

                In the entity Interested parties -> List view, select the desired data records, then a menu “Actions” -> Recalculate formula appears above them.

              • shalmaxb
                shalmaxb commented
                Editing a comment
                There is at least one more error in the formula: it must be erstgespraechTermin, filed names start with small letter.
                And I do not really understand firstname and &email. Should these word be part of the URL? Because how you wrote the string, the terms firstname and &email will be output. Or would you like to have these as placeholders?
            • ChrisSka83
              Senior Member
              • Apr 2023
              • 197

              #10
              Oh, now I've found the error.
              I gave you the wrong tip.

              The thing with the brackets was only in mail templates.
              And leave out the last apostrophe!

              PHP Code:
              buttonname = string\concatenate('https://domain.com/?firstname=',Vorname,'&Nachname=',Nachname,'&email=',E-Mail);
              
              Last edited by ChrisSka83; 10-06-2024, 08:12 PM.

              Comment


              • ChrisSka83
                ChrisSka83 commented
                Editing a comment
                If you try out a new formula, be sure to try the sandbox in the admin area.
                It will also tell you where the error is.
                #Admin/formulaSandbox

                In the frontend, it will not execute the formula if it is incorrect. But it also does not display an error.
            • ChrisSka83
              Senior Member
              • Apr 2023
              • 197

              #11
              aysal
              I think you need to get the structure right first.
              Write field names in English, then you will have fewer problems in the forum if a question does arise.

              Change your fields from
              Vorname -> firstName
              Nachname -> lastName
              E-mail -> eMail

              The field names always start with a lower case letter, as shalmaxb already mentioned.

              Then your formula should look like this:
              PHP Code:
              ​erstgespraechTermin = string\concatenate('https://cal.com/ender-aysal-gznuwa/finales-beratungsgesprach?firstname=',firstName,'&email=',eMail);
              ​​ 
              
              You will then receive a link:


              The attributes of cal.com must of course be correct. I can't tell you what they are called because I don't use cal.com.
              So are they firstname and email ?​

              Comment

              • aysal
                Junior Member
                • Nov 2023
                • 11

                #12
                Thx a lot - after a lot of try i managed it - thx a lot again

                Comment

                Working...