Announcement

Collapse
No announcement yet.

Workflow to assign cases to teams

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

  • Workflow to assign cases to teams

    Hello!

    I'm trying to to set up a system where incoming cases are automatically distributed between two teams working in our company.
    Incoming case will always contain standard form in Description field:
    Description
    ----- Support request automatic generated mail -----
    Case type: Firewall
    Case issue: Connect
    Country: Latvia
    Username:
    Subject: TEST Please ignore
    ...
    So goal is simple - IF string Description contains 'Latvia' THEN assign to 'teamLatvia' ELSE assign to 'teamLithuania'.

    So far I've come up with this:

    Code:
    ifThenElse(
      string\contains(description, 'Latvia'),
      assignedTeamId = 'teamLatvia'; status = 'Assigned'
      ifThen(
          string\contains(description, 'Lithuania'),
          assignedTeamId = 'teamLithuania'; status = 'Assigned'
          )
    );
    Question 1: how do I figure out Team ID? It's not listed when opening team page. Also that "assignedTeamId" is just my improvisation, based on example here - https://www.espocrm.com/documentatio...ation/formula/. Checked around Administration page, but didn't see anything named Environmental Variables or similar.
    Question 2: if values are assigned in IF (which is in Conditions section), do I need to add anything in Actions section?
    Question 3: am I identifying field Description correctly - without any quotation marks or anything?

    It would help if there was a way to test this without actually creating new case each time - some kind of preview option, to see Syntax + how many entities would be affected. Something like Powershell -whatif argument, so I can do my tests first and only then set Workflow to Active.

    Any help appreciated!

  • #2
    Hello,
    1. Open a detail view of your team and take a look at the URL string (e.g. http://localhost/espocrm/#Team/view/52bd3ee937361). 52bd3ee937361 is the team ID.
    2. W/o action, the 'IF' statement doesn't make sense.
    3. Identifying of the DescriptionIt field looks correctly.
    I think you need to rewrite your formula, because it will never execute this part of the formula:
    Code:
    ifThen(
        string\contains(description, 'Lithuania'),
        assignedTeamId = 'teamLithuania'; status = 'Assigned'      
    )
    Last edited by Maximus; 10-29-2019, 09:12 AM.

    Comment


    • #3
      Thanks for clarification!

      Right now I'm going for working concept, so I set it up like this, ignoring second team (after all, I can create another workflow for that):

      Workflow trigger type: After record created;
      Active: checked.

      Condition:
      Code:
      ifThen(
        string\contains(description, 'Latvia'),
        teamsIds = '5c263ed135b555052';
      );
      Action:
      Code:
      Apply Assignment Rule
      Assignment Rule
      Round-Robin
      Target Team
      [URL="https://my.nodbaltic.com/#Team/view/5c263ed135b555052"]LV NOD[/URL]
      Target User Position
      --All--
      It didn't work on the first run, because my imagined "assignedTeamId" was wrong - I missed the part that I can insert attributes from system and don't have to guess them.

      Question: This setup assigns Case to user from correct team, but the team remains default. Is there a way how to assign it to Team itself, instead of user?

      Comment


      • #4
        You can avoid using Workflow and use Formula to achieve what you want. For example, add this Formula for the demanded entity:
        Code:
        ifThen(
          entity\isNew() && string\contains(description, 'Latvia'),
          entity\addLinkMultipleId('teams', '52bd3ee937361');
          status = 'Assigned'
        );
        
        ifThen(
          entity\isNew() && string\contains(description, 'Lithuania'),
          entity\addLinkMultipleId('teams', '52c553e73f0f8');
          status = 'Assigned'
        );
        Note: set correct teamsIds for the 'Lithuania'.
        As you can see I have used the entity\addLinkMultipleId function to add team Id to this field.
        This formula should be executed if you will create a new record and before you press save the 'description field will contain Latvia or Lithuania

        Comment

        Working...
        X