Workflow for case to auto switch to "in progress"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Emmker
    Member
    • Nov 2023
    • 64

    Workflow for case to auto switch to "in progress"

    I need the case status to auto switch to "in progress" when there are no unreplied emails that are not from our Address in a case.

    I tried to find the count of the emails with that criteria, in formula sandbox with:
    PHP Code:
    $noOfEmails = record\count('Email', 'parentId=', $caseId, 'fromAddress=' 'test@email.com');
    output\printLine($noOfEmails) 
    
    but I get "error 500"
    No primary filter 'fromAddress'

    any ideas?
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    Originally posted by Emmker
    I need the case status to auto switch to "in progress" when there are no unreplied emails that are not from our Address in a case.

    I tried to find the count of the emails with that criteria, in formula sandbox with:
    PHP Code:
    $noOfEmails = record\count('Email', 'parentId=', $caseId, 'fromAddress=' 'test@email.com');
    output\printLine($noOfEmails) 
    
    but I get "error 500"
    No primary filter 'fromAddress'

    any ideas?
    you are missing a comma between fromAddress and the value hence why system thinks it is a primary filter. try this

    PHP Code:
    $noOfEmails = record\count('Email', 'parentId=', $caseId, 'fromAddress=', 'test@email.com');
    output\printLine($noOfEmails);
    Rabii
    Web Dev

    Comment

    • Emmker
      Member
      • Nov 2023
      • 64

      #3
      Originally posted by rabii

      you are missing a comma between fromAddress and the value hence why system thinks it is a primary filter. try this

      PHP Code:
      $noOfEmails = record\count('Email', 'parentId=', $caseId, 'fromAddress=', 'test@email.com');
      output\printLine($noOfEmails);
      Thank you. I wasn't missing a comma on the sandbox, It was a typo in the forum.
      Same thing.
      error 500

      Comment


      • yuri
        yuri commented
        Editing a comment
        According the error message "No primary filter 'fromAddress'", it was a missing comma issue.
    • yuri
      Member
      • Mar 2014
      • 8440

      #4
      The error in the log tells for itself:
      ERROR: (42S22) SQLSTATE[42S22]: Column not found: 1054 Unknown column 'email.from_address' in 'where clause'; POST /Formula/action/run; line: 77, file: D:\xampp\htdocs\espo\application\Espo\ORM\Executor \DefaultSqlExecutor.php


      There's no fromAddress attribute in Email. You can use "fromAddressId=" instead. But you will need to obtain the email address ID first.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      • Emmker
        Member
        • Nov 2023
        • 64

        #5
        I run
        PHP Code:
        output\printLine(fromAddressId) 
        
        from formula sandbox with target type: Email and Target: one email with the sender I want, and I get null

        There's no fromAddress attribute in Email. You can use "fromAddressId=" instead. But you will need to obtain the email address ID first.
        Never mind. I ran it with fromEmailAddressId and I got the id
        Last edited by Emmker; 02-19-2024, 10:33 AM.

        Comment

        Working...