Announcement

Collapse
No announcement yet.

Default Value Of User

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

  • Default Value Of User

    Hi,

    In accounts, assigned user shows the name of logged in user by default.

    I have one departments field in which I want to show department of the logged in user by default.

    Please help.

    Thanks Click image for larger version

Name:	Untitled.png
Views:	648
Size:	24.2 KB
ID:	31306

  • #2
    Hello
    The easiest way is set the value of this field with Formula. But this field will be filled only after save (you can add a condition if field is not set, then set it).
    if you want to make this field prefilled, you need to override the view of this field and set the value there

    Comment


    • #3
      Thanks for your reply Tanya.

      Formula for a text field works fine. I am confused in case of related field like departments.

      As you said I want the field to be prefilled. I tried like this.
      Click image for larger version

Name:	Untitled1.png
Views:	670
Size:	15.3 KB
ID:	31332

      But not working. I am new to EspoCrm. Please help.

      Thanks.
      Attached Files

      Comment


      • #4
        this.model.get('assignedUser.departmentId') ? don't think the model has this value (you always can print data in log and check, what does contain the model)... if you need data of logged user use
        Code:
        this.getUser().get('....')

        Comment


        • #5
          Can you please tell me where should I define departments field?

          I created departments.js file in client\custom\src\views\account\fields

          Comment


          • #6
            you could create the file there. but you need to set the the view of field in entityDefs

            Comment


            • #7
              it Worked. Thanks tanya.

              Comment

              Working...
              X