Announcement

Collapse
No announcement yet.

Disabling auto-follow after create

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

  • Disabling auto-follow after create

    It seems that no matter what the setting of "Auto Follow" is (Follow Created Entities is unchecked), users are always following the opportunities they created.

    Is this a user-specific setting?

    Auto-Follow (under user preferences) is empty too...

    Thanks for your advice

  • #2
    Hello
    No, Opportunity works in general way. Except Lead convert. If user follow lead and convert it, he / she will follow entities, are created after convert

    Comment


    • #3
      So, is this a bug? It seems that however everything is disabled, users are still following the records (opportunities) they created in the system.

      How can I turn this off?

      Comment


      • #4
        did you customize your EspoCRM? (I ask about code, not settings in Entity Manager and Layout Manager )

        Comment


        • #5
          one more question: are we mean created By user or assigned User? Because assigned user is always followed the record. And also, user in own preferences can select entity list to follow all new records

          Comment


          • #6
            Tanya, no customizations made.

            I have a workflow that clears the assigned-to after creation, probably I should add a rule to clear the Followed By?
            Is this possible?

            Comment


            • #7
              In user preferences you can set Do not fill Assigned User if not required. With workflow you can only Follow...
              better place to unset assigned user is beforeSave hook

              Comment


              • #8
                That seems like a really cool functionality!

                However, I get errors when doing the following, I've created a AssignedUser.php in custom/Espo/Custom/Hooks/Opportunity/ with following code:

                Code:
                namespace Espo\Custom\Hooks\Opportunity;
                
                use Espo\ORM\Entity;
                
                class AssignedUser extends \Espo\Core\Hooks\Base
                {
                public function beforeSave(Entity $entity, array $options = array())
                {
                if($entity->isNew()) {
                $entity->set("assignedUserId", null);
                $entity->set("assignedUserName", "");
                }
                }
                }
                But the log shows the following warnings;
                [2017-10-23 18:38:58] Espo.WARNING: E_WARNING: array_diff(): Argument #1 is not an array {"code":2,"message":"array_diff(): Argument #1 is not an array","file":"/home/uagito/domains/agito-labs.be/public_html/CRM/application/Espo/Core/HookManager.php","line":171,"context":{"hookDirs":["custom/Espo/Custom/Hooks"],"hookData":[],"hookDir":"custom/Espo/Custom/Hooks","fileList":{"Opportunity":["AssignedUser.php"]},"hookFiles":["AssignedUser.php"],"scopeName":"Opportunity","hookScopeDirPath":"cus tom/Espo/Custom/Hooks/Opportunity","normalizedScopeName":"Opportunity"," scopeHooks":[],"hookFile":"AssignedUser.php","hookFilePath":"cus tom/Espo/Custom/Hooks/Opportunity/AssignedUser.php","className":"\\Espo\\Custom\\Hoo ks\\Opportunity\\AssignedUser","classMethods":null }} []
                [2017-10-23 18:38:58] Espo.WARNING: E_WARNING: Invalid argument supplied for foreach() {"code":2,"message":"Invalid argument supplied for foreach()","file":"/home/uagito/domains/agito-labs.be/public_html/CRM/application/Espo/Core/HookManager.php","line":173,"context":{"hookDirs":["custom/Espo/Custom/Hooks"],"hookData":[],"hookDir":"custom/Espo/Custom/Hooks","fileList":{"Opportunity":["AssignedUser.php"]},"hookFiles":["AssignedUser.php"],"scopeName":"Opportunity","hookScopeDirPath":"cus tom/Espo/Custom/Hooks/Opportunity","normalizedScopeName":"Opportunity"," scopeHooks":[],"hookFile":"AssignedUser.php","hookFilePath":"cus tom/Espo/Custom/Hooks/Opportunity/AssignedUser.php","className":"\\Espo\\Custom\\Hoo ks\\Opportunity\\AssignedUser","classMethods":null ,"hookMethods":null}} []

                I don't see anything to be triggered. Are these warnings problematic?

                Don't I need to change the beforeSave to afterSave?

                Comment


                • #9
                  Hello
                  start you file with <?php

                  Comment


                  • #10
                    Ok, me stupid

                    Comment

                    Working...
                    X