# Form post and update mails

# Flow of Form post Email and update Community Form Email

# Form → Community → Domain Copy: Email Functionality

## Overview

The form-sharing functionality involves three stages:

1. A form is created and published in a **domain database**.
2. The form is **posted to the Community**, making it available to other companies/domains.
3. Another company can **copy the Community form into its own domain**.

The type of email sent depends on **what operation is being performed**.

---

## 1. First Time: Domain Form → Community

Suppose a form is created in the **BZCtrl domain database**.

```text
BZCtrl Domain DB
      │
      │ Create Form
      ▼
   Form Created
      │
      │ Save / Publish
      ▼
   Domain Form
      │
      │ Post to Community
      ▼
┌─────────────────────┐
│   Community Form    │
│                     │
│ Same form available │
│ in Community DB     │
└─────────────────────┘
      │
      ▼
Post Form Email
      │
      ▼
All users of the application

```

### Email behavior

When the form is posted to Community **for the first time**:

- A Community copy of the form is created.
- A **Post Form Email** is sent.
- The email is sent to **all users of the application**.

### Important

At this point:

```text
BZCtrl Domain Form
        +
Community Form

```

both exist.

---

# 2. Existing Domain Form Updated → Community Updated

Now suppose the same form in the **BZCtrl domain database** is modified.

The updated form is then posted to Community again.

```text
BZCtrl Domain DB
      │
      ▼
Existing Domain Form
      │
      │ Update Form
      ▼
Updated Domain Form
      │
      │ Post Again
      ▼
Existing Community Form
      │
      │ Update
      ▼
Updated Community Form
      │
      ▼
Update Community Form Email
      │
      ▼
Managers of relevant companies

```

### Email behavior

Because the Community form already exists, this is **not treated as a new Community form**.

Therefore:

**Update Community Form Email** is sent instead of **Post Form Email**.

The email is sent to the **managers of the companies/domains that have copied the Community form**.

### Example

```text
BZCtrl
  │
  └── Form A
       │
       ▼
   Community
       │
       ├── Company VTTI copied Form A
       ├── Company XYZ copied Form A
       └── Company ABC copied Form A

BZCtrl updates Form A
       │
       ▼
Community Form A updated
       │
       ▼
Update Community Form Email
       │
       ├──→ VTTI Manager
       ├──→ XYZ Manager
       └──→ ABC Manager

```

The purpose of this email is essentially to tell the companies that have previously copied the Community form:

> A newer version of this Community form is available.

---

# 3. Community Form → Another Domain

Now suppose **VTTI** copies the Community form into its own domain database.

```text
Community DB
     │
     │ Copy Form
     ▼
VTTI Domain DB
     │
     ▼
Community Form Copy

```

At this point, the VTTI form is a **domain copy of the Community form**.

It is not automatically a new Community post.

---

# 4. Updating a Community-Copied Form in the Domain

Suppose VTTI modifies its copied form.

```text
Community Form
      │
      │ Copy
      ▼
VTTI Domain Form
      │
      │ Modify
      ▼
Modified VTTI Form

```

Simply modifying the VTTI copy **does NOT automatically update the Community form**.

Also, simply having changes in the copied form does not mean that the changed version can immediately be posted back to Community.

### To post the changed version again:

The VTTI user must:

```text
Community Form
      │
      │ Copy again
      ▼
New VTTI Domain Form Copy
      │
      │ Make required changes
      ▼
Updated VTTI Domain Form
      │
      │ Post to Community
      ▼
Community
      │
      ▼
Post Form Email
      │
      ▼
All application users

```

### Important email behavior

When the domain user copies the Community form again, modifies it, and posts it:

**Post Form Email** is sent.

It is **NOT** treated as an "Update Community Form Email" scenario.

So:

```text
Domain's own form → existing Community form
        ↓
UPDATE COMMUNITY FORM EMAIL

```

whereas:

```text
Community form → copied into domain → modified → posted
        ↓
POST FORM EMAIL

```

---

# Complete Functionality Flow

```text
                         ┌─────────────────────┐
                         │  Create Form in     │
                         │  Domain DB (BZCtrl) │
                         └──────────┬──────────┘
                                    │
                                    ▼
                         ┌─────────────────────┐
                         │ Save / Publish Form │
                         └──────────┬──────────┘
                                    │
                                    ▼
                          Post Form to Community
                                    │
                                    ▼
                         ┌─────────────────────┐
                         │ Community Form      │
                         │ Created             │
                         └──────────┬──────────┘
                                    │
                                    ▼
                           POST FORM EMAIL
                                    │
                                    ▼
                         All Application Users
                                    │
                                    │
                  ┌─────────────────┴─────────────────┐
                  │                                   │
                  ▼                                   ▼
       Update original domain              Other company copies
             form                         Community form
                  │                                   │
                  ▼                                   ▼
       Post to Community again             Domain copy created
                  │                                   │
                  ▼                                   ▼
       Existing Community Form             Company modifies copy
             updated                               │
                  │                                 │
                  ▼                                 ▼
    UPDATE COMMUNITY FORM EMAIL             Copy Community form
                  │                           again into domain
                  ▼                                 │
       Managers of companies                      ▼
       that copied the form                  Make changes
                                                    │
                                                    ▼
                                             Post to Community
                                                    │
                                                    ▼
                                             POST FORM EMAIL
                                                    │
                                                    ▼
                                           All Application Users

```

---

# Email Decision Table

<table class="e-rte-table" id="bkmrk-scenariocommunity-fo"><thead><tr><th>Scenario</th><th align="right">Community Form Exists?</th><th>Operation</th><th>Email</th></tr></thead><tbody><tr><td>Domain form posted for the first time</td><td align="right">No</td><td>Create Community form</td><td>**Post Form Email**</td></tr><tr><td>Original domain form updated and posted again</td><td align="right">Yes</td><td>Update existing Community form</td><td>**Update Community Form Email**</td></tr><tr><td>Community form copied to another domain</td><td align="right">Yes</td><td>Copy only</td><td>**No Post/Update email**</td></tr><tr><td>Copied domain form modified</td><td align="right">Yes</td><td>Local domain modification</td><td>**No email**</td></tr><tr><td>Community form copied again → modified → posted</td><td align="right">Yes</td><td>New domain form posted</td><td>**Post Form Email**</td></tr></tbody></table>

---

## Key Rule to Remember

> **The email type depends on where the form being posted originated and what operation is being performed.**

### Original domain form being reposted

```text
Original Domain Form
        ↓
Existing Community Form
        ↓
UPDATE COMMUNITY FORM EMAIL

```

### Community form copied into a domain and then posted

```text
Community Form
        ↓
Domain Copy
        ↓
Copy Again
        ↓
Modify
        ↓
Post
        ↓
POST FORM EMAIL

```

Therefore, a **Community-copied form is not automatically considered an update to the Community form merely because it originated from Community**. The domain user must create the appropriate new copy, make changes, and explicitly post it again.