Recommended Approach for Email Classification Using Multiple Inbound Email Trigger Flows

ShumaS
Tera Contributor

Hello Community,

I would like to get feedback on the architecture of an inbound email processing solution.

## Background

We receive various types of emails that must be processed differently based on conditions such as sender, subject, and email content.

In addition, any email that does not explicitly match a defined processing rule should ultimately be classified as Junk.


## Proposed Architecture

I am considering implementing this using multiple Inbound Email Trigger Flows.

The system property `glide.hub.flow.inbound_email_trigger.show_advanced` would be enabled so that multiple flows can be configured and ordered.


### Processing Flow

1. An initial flow (Order = 0) receives the email and leaves it in the Inbox state.
2. Multiple business-specific flows (Order > 0) evaluate the email and perform their respective processing.
3. When a flow successfully processes the email, it updates the email status to `Received`.
4. A final flow (Order = 9999) evaluates the email:
- If the status is `Received`, no further action is taken.
- If the status is not `Received`, the email is classified as Junk.


### Goals

- Separate processing logic into independent flows.
- Simplify future maintenance and addition of new email-processing rules.
- Ensure that any email not matched by a processing rule is automatically treated as Junk.


## Questions


### 1. Is this architecture reasonable?

Has anyone implemented a similar pattern using multiple Inbound Email Trigger Flows?

In particular, are there any concerns with:

- Using the Order field to control processing sequence across multiple flows?
- Using the email status as a flag to indicate whether an email has already been processed?


### 2. Inbound Email Trigger Flow vs. Inbound Email Action

For this type of requirement, would you recommend:

- Inbound Email Trigger Flows
- Inbound Email Actions

I would appreciate recommendations from the perspectives of:

- Maintainability
- Scalability
- Processing order control
- Performance
- ServiceNow best practices


### 3. Status Update Visibility Across Flows

If multiple Inbound Email Trigger Flows are executed for the same email, can a later flow reliably determine whether an earlier flow has changed the email status (for example, to `Received`)?

Are there any transaction, execution-order, or timing considerations that could affect this design?

Any guidance, best practices, or alternative approaches would be greatly appreciated.


Thank you.

0 REPLIES 0