Announcement

Collapse
No announcement yet.

Help with workflow or flowchart

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

  • Help with workflow or flowchart

    Need some help with Workflow.

    I need a workflow to scan every minute the cases, find the cases that the last email that was received is not replied, and change the status of these cases to a status that I created that is "Needs Reply"


    I now have created a Case Report with filters:

    status - none of: 'new' 'Needs Reply'
    and
    Emails.is Replied - No


    Then I created a Scheduled (* * * * *) Case workflow with target report, the aforementioned.
    and actions
    PHP Code:
    $lastemail record\findOne('Email''createdAt''desc''parentId='id,'fromEmailAddressId!=''65476202572deca29','createdAt>''2024-03-07');
    $lastemailreplied record\attribute('Email'$lastemail'isReplied');

    ifThen($lastemailreplied == 'false',
    record\update('Case'id'status''Needs Reply')
    )
    ​ 

    The workflow log shows multiple entries of the Case that it should act upon, and nothing is changed.

    Any ideas would be pretty much appreciated.
    Last edited by Emmker; 03-20-2024, 06:44 PM.

  • #2
    Hi,
    not sure but i think :

    PHP Code:

    ifThen
    ($lastemailreplied == false,   // not string.  or ifThen($lastemailreplied,  ...   
    record\update('Case'id'status''Needs Reply')
    )
    ​  ​ 

    Comment


    • Emmker
      Emmker commented
      Editing a comment
      I tried that too but same result.

  • #3
    SOLVED

    The problem was that the
    Code:
    record\update('Case', id, 'status', 'Needs Reply'​
    was apparently looping the 'id' portion on the reported cases and it failed.

    I replaced that with:

    PHP Code:
    ifThen($lastemailreplied == false,
    entity\setAttribute('status''Needs Reply')
    )
    ​ 
    and it worked fine, switching all the cases that the if statement find true, to the correct status.

    Thanx item for the help.

    Comment

    Working...
    X