Email in Queue flow error does not give consistent data results

I am trying to get around the design that does not allow me to apply any flow logic to an in queue email. I am not sure this was a decision that best fits how to utilize API calls and Data Action to address requirements.
I have found that I can put an inbound email for a new, or reopened threat in a loop and preform logic, but Genesys is inconsistent at best. I have a data action to get the email attachment information, it checks each time it loops. I apply logic to set the tag based on a success, or I just continue to loop if there is no email attachment for X number of hours. This seems to basically work.

However I a able to crash the flow, and I also get poor or crazy results for embedded built in variables. For instance Email.Message.attachments[0].name as a Set Participant Data will successfully give me the name of the 1st attachments in a thread. But it will give an error based on the Genesys logs that it is out of bounds for the next loop that has an email attachment. This is a collection, an array, I fond that to be a bug.

Also, Count(Email.Message.attachments) == 0 have very strange results. What I have found it that if I put
Set Participant Data , Count(Email.Message.attachments) At the op of the loop, just before my data action, It will return a 0 the first time around and then 1 and stops.
Email.Message.attachments[0].name , this gives me the results in the participant data, then I get the error.
These really have nothing to do with any data action, but the platform will not get the data after the 1st time. I believe its broken, it should work or not, not work one or two times then crash
My open ticket is Case #0003382347.
here is the log data. for the name array;
Exception (com.inin.workflow.exceptions.pub.IndexOutOfBoundsEvaluateException): Expression index out of bounds near position 13
t:"2023-10-15T00:47:34.109Z",

message:"EXECLOOP: Executing actions caused an exception, put the flow in error. Context=[organizationId=2a6ab887-dbc9-4404-8914-f2970c8cc8e7, flowConfigType=InqueueEmail, flowConfigId=[4efd081a-0b83-4aff-a76c-00816b931c73:3.0.0 ([REDACTED len=21])], flowConfigName=[REDACTED len=21], flowExecId=ti267m4tv88385o6invemjkr9rc020mn4osec0qu80b2shdfok, flowInstanceName=[REDACTED len=80], conversationId=110c8fe4-61c9-4488-8fbf-b846fc6edf42, runningState=Running, launchTime=2023-10-15T00:46:01.697Z, errorCode=null, actionExecCount=18]

Error=

Exception (com.inin.workflow.exceptions.pub.IndexOutOfBoundsEvaluateException): Expression index out of bounds near position 13

Position 13 is where the array position is, that worked once and not again.

I need to know when an email attachment comes in, and because its an array and read only, I must know that a reopened threat does or does not have a new attachment. The decision on the data action seems to give me "success" when it is reopened simply because the built-in variable gives me the last result from the previous thread but I can never get to it consistently. I will upload the flow here so you can see what I am doing.

I could really use some help. Been working on this for weeks.
regards,
Nick

Here is the flow, one of the version anyway.
Email-Aging-Attachment-Name-Variable-20231013112032.custom.json (1.1 KB)

Hey Nick,

I've taken a look at the flows execution ID, that was part of the exception message you saw regarding the IndexOutOfBoundsEvaluateException.

Looking at that particular flows execution, it appears the flow executed like this:

    Loop 1:
            Call Data Action
            Set Participant Attributes Action 
            Set External Tag Action
            Wait Action
            Continue Action
    Loop 2:
             Call Data Action
             Set Participant Attributes Action 
             Set External Tag Action
             Wait Action
             Continue Action
    Loop 3:
             Call Data Action          
             Set Participant Attributes Action 
             Set External Tag Action
             Wait Action
             Continue Action
    Loop 4:
             Call Data Action
     	 Set Participant Attributes Action- Error Handling Invoked

From the logs, it seems that outer loop is configured to loop 99 times. I'm not certain since I can not see the flow in the UI, but my assumption is the Set Participant Attributes Action is referencing the Email.Message.attachments indexes using the loop variables index. Presuming theres not 99 attachments in that array, the Inqueue Email Flow is invoking error handling, as the 4th loop iteration will be out of bounds for the size of Email.Message.attachments.

So my suggestion is to set the loops Maximum Loop Count with the expression:
Count(Email.Message.attachments)
This should only loop for the size of the attachments.

Hope this was clear, please let me know if I didn't get the scenario correct, or if my provided solution isn't working quite right.

Best regards,
Jordon.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.