Formula for Assigning Specified User's Team

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lj4353
    Senior Member
    • Nov 2023
    • 158

    #1

    Formula for Assigning Specified User's Team

    Regarding the synchronous setting of assignedUser.teamsNames, I aim to set the work team to be the same as a specified user's team. However, the formula I attempted to use resulted in displaying [object Object], indicating a potential need to convert the object into a string format or to extract specific data from the object.​
    Click image for larger version

Name:	image.png
Views:	260
Size:	49.5 KB
ID:	100748Click image for larger version

Name:	image.png
Views:	209
Size:	26.6 KB
ID:	100749
  • rabii
    Active Community Member
    • Jun 2016
    • 1339

    #2
    teamsNames is a notStorable so you need to use the teamsIds instead, but if you want to see the name you can just loop through them and build your string.
    Rabii
    EspoCRM & Web Dev

    🔗 See what I’ve built for EspoCRM

    Comment


    • lj4353
      lj4353 commented
      Editing a comment
      How exactly should I proceed?
  • rabii
    Active Community Member
    • Jun 2016
    • 1339

    #3
    try this instead:

    PHP Code:
    $teamsIds assignedUser.teamsIds;

    $i 0;

    while (
    $i array\length($teamsIds)) {
        
        
    $team record\fetch('Team'array\at($teamsIds$i));
        
        if (
    $team) {
            
    job string\concatenate(job' 'object\get($team'name')) ;
        }
        
        
    $i $i 1;
    }
    ​ 
    Rabii
    EspoCRM & Web Dev

    🔗 See what I’ve built for EspoCRM

    Comment

    Working...