How to clear the "assigned to" relation by default

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oscarcookie
    Member
    • Oct 2016
    • 34

    How to clear the "assigned to" relation by default

    Is there a way to clear the assigned-to field by default?

    My customer doesn't want the user that creates the record to be assigned by default.

    I tried using workflows, but with no success.

    Thanks!
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello
    You can configure 'Do not fill Assigned User if not required' In User Preferences.
    or set in worflow action Update Entity and set in formula
    Code:
    assignedUserId=null;
    assignedUserName='';

    Comment

    • oscarcookie
      Member
      • Oct 2016
      • 34

      #3
      Cool,

      Is there a way to use a formula to assign to the current user? (I want to do this in case of a certain status)

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        Yes, you can do this
        https://github.com/espocrm/documenta....md#ifthenelse
        https://github.com/espocrm/documenta...vuserattribute

        https://github.com/espocrm/documentation/blob/master/docs/administration/formula.md#examples


        Comment

        • oscarcookie
          Member
          • Oct 2016
          • 34

          #5
          Thanks for your help, I found that, and used:

          assignedUserId=env\userAttribute('id');
          assignedUserName=env\userAttribute('name');

          or

          assignedUserId=env\userAttribute('UserId');
          assignedUserName=env\userAttribute('UserName');


          But with no success yet.

          Is the syntax correct?

          What a powerful option!!

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            first one works for me
            check the condition

            Comment

            • oscarcookie
              Member
              • Oct 2016
              • 34

              #7
              Works indeed... Thanks Tanya!

              Comment

              • Shuan Paul
                Junior Member
                • Jun 2017
                • 8

                #8
                Yes you can set in worflow action Update Entity and set in formula.

                Comment

                • bandtank
                  Active Community Member
                  • Mar 2017
                  • 379

                  #9
                  How do you set "Do not fill Assigned User if not required" for every user by default?

                  Comment

                  • bandtank
                    Active Community Member
                    • Mar 2017
                    • 379

                    #10
                    Adding

                    Code:
                    "default": true
                    to

                    Code:
                    application\Espo\Resources\metadata\entityDefs\Preferences.json
                    used to work, but it no longer does:

                    Code:
                    "doNotFillAssignedUserIfNotRequired": {
                        "type": "bool"
                        "default": true
                    },

                    Comment

                    • tanya
                      Senior Member
                      • Jun 2014
                      • 4308

                      #11
                      Hello

                      You did right thing, but in not upgrade safe way. Also you lost comma. But it will work only for new users

                      Comment

                      • bandtank
                        Active Community Member
                        • Mar 2017
                        • 379

                        #12
                        Originally posted by tanya
                        Hello

                        You did right thing, but in not upgrade safe way. Also you lost comma. But it will work only for new users
                        So is there not a way to do it with a setting for every user by default? Do I have to use a workflow?

                        Comment

                        • tanya
                          Senior Member
                          • Jun 2014
                          • 4308

                          #13
                          It set this field by default. But, for active users, preferences were created with old default value. An administrator can change preferences for each user. For new ones this preference will be set in True
                          Workflows are triggered after save (notifications could be created), Formula is triggered before save. But needs to check the order of auto-fill functionality and formula: what runs the last

                          Comment

                          Working...