Stream|Post

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coca22052022
    Junior Member
    • Apr 2023
    • 19

    Stream|Post

    I want to display a post with "Stream Post" in the "Leads" tab in the Comment column. How to do it? I need this tab to display the latest messages left by employees. Help me please...
  • eymen-elkum
    Active Community Member
    • Nov 2014
    • 472

    #2
    You can write formula for Note which representing the stream rows from this link:
    Code:
    https://your-crm.com/#Admin/entityManager/formula&scope=Note
    Here is the formula for Case, replace it with Lead:

    Code:
    ifThen(
        parentType == 'Case' && type == 'Post',
    
        record\update('Case', parentId, 'lastComment', string\concatenate(createdBy.name, ': ', post));
    );
    CEO of Eblasoft
    EspoCRM Expert since 2014
    Full Stack Web Developer since 2008
    Creator of Numerous Successful Extensions & Projects​

    Comment


    • Jakub Grufik
      Jakub Grufik commented
      Editing a comment
      hello eymen, this is really cool, is there any reason why the formula of note entity is not accessible manually without modifying the URL? I did not know that you can cheat the system like that.

    • eymen-elkum
      eymen-elkum commented
      Editing a comment
      The right answer is on Yuri side, but I think there are some limitations and potential issues may caused if this used incorrectly, such features will lead to bring more support needs and Espo team is already working full

    • Jakub Grufik
      Jakub Grufik commented
      Editing a comment
      got it, thank you
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #3
    To make sure you get only the latest post when a new one is create use the function like below:
    PHP Code:
    ifThen(
        entity\isNew() && parentType == 'Lead' && type == 'Post',
    
        record\update('Lead', parentId, 'description', string\concatenate(createdBy.name, ': ', post));
    );​​ 
    
    Rabii
    Web Dev

    Comment

    • coca22052022
      Junior Member
      • Apr 2023
      • 19

      #4
      Originally posted by rabii
      To make sure you get only the latest post when a new one is create use the function like below:
      PHP Code:
      ifThen(
      entity\isNew() && parentType == 'Lead' && type == 'Post',
      
      record\update('Lead', parentId, 'description', string\concatenate(createdBy.name, ': ', post));
      );​​ 
      


      I went through the link
      PHP Code:
      #Admin/entityManager/formula&scope=Note 
      
      Added a function
      PHP Code:
      
      ifThen(
          parentType == 'Lead' && type == 'Post',
      
          record\update('Lead', parentId, 'lastComment', string\concatenate(createdBy.name, ': ', post)); )
      ;
      ifThen(
          entity\isNew() && parentType == 'Lead' && type == 'Post',
      
          record\update('Lead', parentId, 'description', string\concatenate(createdBy.name, ': ', post));
      );

      Nothing happened. in Layouts there is no option to add a Last Comment column​​
      Last edited by coca22052022; 05-17-2023, 11:57 AM.

      Comment


      • rabii
        rabii commented
        Editing a comment
        don't use the function twice just use of them no need for the ifThen twice just use one of them. also note that you should change (lastComment Or description) with the field you have on your lead in which you want to print the last post.
    • coca22052022
      Junior Member
      • Apr 2023
      • 19

      #5
      All windows worked!!!

      Comment

      • coca22052022
        Junior Member
        • Apr 2023
        • 19

        #6
        Originally posted by rabii
        To make sure you get only the latest post when a new one is create use the function like below:
        PHP Code:
        ifThen(
        entity\isNew() && parentType == 'Lead' && type == 'Post',
        
        record\update('Lead', parentId, 'description', string\concatenate(createdBy.name, ': ', post));
        );​​ 
        


        Everything works fine, I see the last comment
        How to remove the name of the person who wrote the comment?​

        Comment

        • rabii
          Active Community Member
          • Jun 2016
          • 1250

          #7
          Just remove createdBy.name like below:

          PHP Code:
          ifThen(
          entity\isNew() && parentType == 'Lead' && type == 'Post',
          
          record\update('Lead', parentId, 'description', post);
          );​​  ​ 
          
          Rabii
          Web Dev

          Comment

        • Kharg
          Senior Member
          • Jun 2021
          • 410

          #8
          I decided to start working on an extension for a custom field containing the latest post

          Click image for larger version

Name:	image.png
Views:	612
Size:	38.3 KB
ID:	92588

          Comment

          • coca22052022
            Junior Member
            • Apr 2023
            • 19

            #9
            Originally posted by rabii
            Just remove createdBy.name like below:

            PHP Code:
            ifThen(
            entity\isNew() && parentType == 'Lead' && type == 'Post',
            
            record\update('Lead', parentId, 'description', post);
            );​​ ​ 
            
            how to add a pencil next to the status, so that when clicked, a list with statuses pops up, and you can select a status.?
            how to add a pencil next to the status, so that when clicked, a list with statuses pops up, and you can select a status.?
            how to add a pencil next to the status, so that when clicked, a list with statuses pops up, and you can select a status.?

            Comment

            • rabii
              Active Community Member
              • Jun 2016
              • 1250

              #10
              if you want such behaviour you will have to code it yourself, otherwise there is an extension developed by telecastg which give you such functionality. check it out https://payhip.com/b/ZGQMH
              Rabii
              Web Dev

              Comment


              • esforim
                esforim commented
                Editing a comment
                Surprise you remember this one.

              • rabii
                rabii commented
                Editing a comment
                telecastg is a talented dev so i remember all his work. he has helped a lot here explaining how you can do things and how things work in espocrm. i do remember most of your posts as well.

              • telecastg
                telecastg commented
                Editing a comment
                Thanks for your kind words rabii the feeling is mutual.
            • coca22052022
              Junior Member
              • Apr 2023
              • 19

              #11
              I don't understand what happened, but now it doesn't work.

              I write the link https://office-crm.ru/#Admin/entityM...ula&scope=Note

              This link is throwing an error.
              Help solve the error​

              Comment

              • lazovic
                Super Moderator
                • Jan 2022
                • 809

                #12
                Starting with version 7.5, EspoCRM has a choice between formula scripts: Before-save script and API Before-Save Script.

                Therefore, now, in order to change the formula script for the Note entity, you need to follow the link of the following type: [your_instance_URL]/#Admin/entityManager/formula&scope=Note&type=beforeSaveCustomScript

                Comment


                • Decepticon
                  Decepticon commented
                  Editing a comment
                  Hello lazovic, can you guide me on how to all users within a specific rule be allowed to send messages only to themselves + admin, and not to other users within the same rule?? Your help would be greatly appreciated. Thank you in advance.
                  Last edited by Decepticon; 07-08-2023, 03:58 AM.
              • coca22052022
                Junior Member
                • Apr 2023
                • 19

                #13
                Originally posted by lazovic
                Starting with version 7.5, EspoCRM has a choice between formula scripts: Before-save script and API Before-Save Script.

                Therefore, now, in order to change the formula script for the Note entity, you need to follow the link of the following type: [your_instance_URL]/#Admin/entityManager/formula&scope=Note&type=beforeSaveCustomScript

                ​This does not work! I created a field: text - 'lastcomment' I followed the link:
                [your_instance_URL]/#Admin/entityManager/formula&scope=Note&type=beforeSaveCustomScript

                WRITE a script
                ifThen(
                entity\isNew() && parentType == 'Lead' && type == 'Post',

                record\update('Lead', parentId, 'lastcomment​', post);
                );​​ ​​
                made a note on the tape. nothing appeared on the main page in the last comment column.
                HELP MEEEE

                how to make it work?​
                how to make it work?​


                Comment


                • rabii
                  rabii commented
                  Editing a comment
                  can you share a screenshot of the formula page
              Working...