---
title: Message icon selection
summary: Auto-selects the SAIFMessage control's status icon based on keywords found in the message text.
status: draft
owner: SAIF Documentation Team
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.V2
reference_type: package
operation_id: OP-V2-MSG-001
trigger: Text property set with content containing recognized keywords
---

# Message icon selection

This operation determines which status icon (`Error`/`Warning`/`Complete`) `SAIFMessage` displays, based on keyword scanning of the message text, unless the caller has explicitly overridden the icon.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-V2-MSG-001 |
| **Trigger** | `Text` property set with content containing `"Error:"`, `"Warning:"`, `"Complete:"`, or `"changes saved."`. |
| **Inputs** | `Text` content; `DisplayImage` property (if explicitly set by caller). |
| **Outputs** | `DisplayImage`/`_img.ImageUrl` selection; `"Complete:"` keyword text stripped from the displayed message via regex. |
| **Primary components** | `SAIFMessage.SetImage`, called from `SAIFMessage.RenderControl`. |
| **Entry point** | `SAIF.Presentation.Web.Controls.V2\SAIFMessage.vb` |

## Steps

1. `RenderControl` calls `SetImage` before rendering the image and label. ([BR-V2-005](../business-rules.md#br-v2-005-message-icon-is-derived-from-message-text-keywords-unless-explicitly-overridden))
2. `SetImage` checks `DisplayImage`; if it has not been explicitly overridden (`= Images.DefaultImage`), it scans `Text` (case-insensitive) in this order:
   - Contains `"error:"` → sets image to the error icon (`MsgError.png`).
   - Contains `"warning:"` → sets image to the warning icon (`MsgWarning.png`).
   - Contains `"complete:"` → sets `DisplayImage = Images.CompleteImage` and updates the alternate text.
   - Exact match `"changes saved."`/`"changes saved. <br>"` → sets image to the complete icon (`MsgComplete.png`).
   - Otherwise → defaults to the warning icon.
3. After the keyword scan, any `"complete:"` occurrence in `Text` is stripped via a case-insensitive regex replace, so the keyword itself never displays to the user.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([RenderControl invoked]) --> Check{DisplayImage overridden?}
	Check -->|Yes| Skip([Use caller-supplied image])
	Check -->|No| Scan[Scan Text for keywords]
	Scan --> Error{Contains error:}
	Error -->|Yes| ErrImg([Error icon])
	Error -->|No| Warn{Contains warning:}
	Warn -->|Yes| WarnImg([Warning icon])
	Warn -->|No| Complete{Contains complete:}
	Complete -->|Yes| CompImg[Complete icon, strip keyword text]
	Complete -->|No| Saved{Exact match changes saved.}
	Saved -->|Yes| CompImg2([Complete icon])
	Saved -->|No| DefaultImg([Default: warning icon])
```

## Failure and edge-case behavior

- This is a **UI convention** for auto-selecting status iconography by message-text keyword, not a business rule about application data.
- The client-side `Message.js` script referenced for postback re-rendering is not present in this project folder; its exact behavior could not be verified from this library's source**.

> **Note:** Statements marked with ** could not be confirmed; treat as unknown until verified.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- SAIF.Presentation.Web.Controls.V2\SAIFMessage.vb
