# UCC.Site.Creator - List Removal Specification

## Overview

This document details all files, code sections, and artifacts that must be removed or modified to eliminate the following lists and libraries from the UCC.Site.Creator script:

| List/Library Name | Type | Content Type(s) | Status |
|-------------------|------|-----------------|--------|
| BridgAuth | List | BridgAuth | Removed |
| BridgDocuments | Document Library | (default) | Removed |
| ChatQuestions | List | ChatQuestion | Removed |
| ~~IDRQuestions~~ | ~~List~~ | ~~IDRQuestion, IDRSystemItem~~ | **REINSTATED** |
| Notifications | List | Notification | Removed |
| RetentionPolicy | List | RetentionPolicyItem | Removed |
| Survey | Survey List | (survey template) | Removed |
| TimerJobs | List | TimerJob | Removed |
| TrainerTrainee | List | TrainerTraineeItem | Removed |

> **Note:** IDRQuestions was initially planned for removal but has been **reinstated** in v8.4.1.8. All references to IDRQuestions removal in this document are historical and should be ignored.

---

## 1. PowerShell Script Changes

### 1.1 WSP.UCC-4.Lists.ps1 (List Creation)

**File:** `Anywhere365/Scripts/WSP.UCC-4.Lists.ps1`

**Current code (lines 10-13):**
```powershell
$lists = @("Holidays", "Agents", "Version", "Businesshours", "CallClassifications", "CallSummary", "ChatQuestions", "Endpoints",
            "IDRQuestions", "IVRQuestions", "Notifications", "OutboundDialerCalls", "Playlists", "PromptsConfig", "QualityMonitorConfig",
            "ReasonCodes", "RetentionPolicy", "Routing", "Settings", "settingsList", "SettingValues", "Skills", "SkillsPerAgent", "Supervisors",
            "TimerJobs", "TrainerTrainee", "VoicemailAgents", "PluginAttributes", "PluginFlowSettings", "PluginSettings", "BridgAuth")
```

**New code:**
```powershell
$lists = @("Holidays", "Agents", "Version", "Businesshours", "CallClassifications", "CallSummary", "Endpoints",
            "IDRQuestions", "IVRQuestions", "OutboundDialerCalls", "Playlists", "PromptsConfig", "QualityMonitorConfig",
            "ReasonCodes", "Routing", "Settings", "settingsList", "SettingValues", "Skills", "SkillsPerAgent", "Supervisors",
            "VoicemailAgents", "PluginAttributes", "PluginFlowSettings", "PluginSettings")
```

> **Note:** IDRQuestions is retained in the list above.

**Current code (line 31):**
```powershell
$libraries = @("AudioFiles", "BridgDocuments", "Recordings", "Voicemails")
```

**New code:**
```powershell
$libraries = @("AudioFiles", "Recordings", "Voicemails")
```

**Remove entirely (lines 37-38):**
```powershell
# Survey
AddPnPList "Survey" -Survey | Out-Null
```

---

### 1.2 WSP.UCC-5.ColumnsContentTypes.ps1 (Fields & Content Types)

**File:** `Anywhere365/Scripts/WSP.UCC-5.ColumnsContentTypes.ps1`

**Remove the following sections entirely:**

#### BridgAuth (lines 14-20):
```powershell
# BridgAuth
# Fields
AddPnPFieldFromXml '<Field ID="{04f76dd4-f2a0-436d-a903-9057bced42f9}" Type="Text" Name="wsp_ucc_ba_BridgPhoneNumberId" DisplayName="BridgPhoneNumberId" Group="Anywhere365" />' -IgnoreDuplicateException
# CT
$ctName = "BridgAuth"                                                              
AddPnPContentType $ctName "0x01001d7649211c864c30bce718552cc5667e"
AddPnPFieldsToContentType $ctName @("wsp_ucc_ba_BridgPhoneNumberId")
```

#### ChatQuestion content type (around line 193):
```powershell
AddPnPContentType $ctName "0x010045edea52950746d5b948e8bbec32ec9b" "Add a ChatQuestion item to the ChatQuestions list"
```
And all related ChatQuestion fields.

#### IDRQuestion fields and content types (lines 230-252):
- All `wsp_ucc_idr_*` fields
- `IDRQuestion` content type (0x0100110c5c4757cd43bc8d0524c1aff36d9c)
- `IDRSystemItem` content type (0x0100e9de583898dc4363866a02c1765e6b26)

#### Notification fields and content type:
- All `wsp_ucc_not_*` fields
- `Notification` content type

#### RetentionPolicyItem (lines 488-507):
```powershell
# RetentionPolicyItem
# Fields
AddPnPFieldFromXml '<Field ID="{...}" ... Name="wsp_ucc_rp_list" ...'
# ... all wsp_ucc_rp_* fields
$ctName = "RetentionPolicyItem"
AddPnPContentType $ctName "0x01000ef0233077414f86a4c0bc99a75446c6" "Add a RetentionPolicyItem item to the RetentionPolicy list"
```

#### TimerJob fields and content type (lines 719-768):
- All `wsp_ucc_tj_*` fields
- `TimerJob` content type (0x0100A56F125309054C56A21B6AAC8622970E)

#### TrainerTraineeItem (lines 770-777):
```powershell
# TrainerTraineeItem
# Fields
AddPnPFieldFromXml '<Field ID="{f7968e75-dc28-49e4-80b4-2bcf68851b7e}" Type="Lookup" Name="wsp_ucc_tt_trainer" ...'
AddPnPFieldFromXml '<Field ID="{d4fcf41f-66f1-45a3-b7bc-5f49d2743b83}" Type="Lookup" Name="wsp_ucc_tt_trainee" ...'
# CT
$ctName = "TrainerTraineeItem"
AddPnPContentType $ctName "0x0100aaef994d1a0540cbab9ac90e2dee47fc" "Add a TrainerTraineeItem item to the TrainerTrainee list"
AddPnPFieldsToContentType $ctName @("!wsp_ucc_tt_trainer", "!wsp_ucc_tt_trainee")
```

#### Remove "Survey" from Scope choices (lines 560, 643):
In the Settings/SettingValues field definitions, remove `<CHOICE>Survey</CHOICE>` from the Scope field choices.

#### Remove "IDRQuestions" from TimerJob List choices (line 751):
Remove `<CHOICE>IDRQuestions</CHOICE>` from the `wsp_ucc_tj_list` field definition.

---

### 1.3 WSP.UCC-6.Views.ps1 (Views & Forms)

**File:** `Anywhere365/Scripts/WSP.UCC-6.Views.ps1`

**Remove the following try/catch blocks entirely:**

#### BridgAuth (lines 72-88):
```powershell
try
{       
    # List BridgAuth
    $listTitle = "BridgAuth"
    # Add CTs
    AddPnPContentTypesToList $listTitle @("BridgAuth")
    # Add views
    AddPnPView $listTitle "AllItems" "AllItems" 30 ...
    # Add forms
    AddForms $relativeURL $listTitle
    # Change Title
    ChangeFieldTitle "Title" "PhoneNumber" $listTitle -Required
}
catch 
{
    Error "Exception on list $listTitle : $($_.Exception.Message)"
}
```

#### ChatQuestions (lines 143-157):
```powershell
try
{
    # List ChatQuestions
    $listTitle = "ChatQuestions"
    ...
}
catch { ... }
```

#### IDRQuestions (lines 203-219):
```powershell
try
{
    # List IDRQuestions
    $listTitle = "IDRQuestions"
    ...
}
catch { ... }
```

#### Notifications (lines 255-269):
```powershell
try
{	   
    # List Notifications
    $listTitle = "Notifications"
    ...
}
catch { ... }
```

#### RetentionPolicy (lines 417-430+):
```powershell
try
{	   
    # List RetentionPolicy
    $listTitle = "RetentionPolicy"
    ...
}
catch { ... }
```

#### TimerJobs (lines 570-590):
```powershell
try
{
    # List TimerJobs
    $listTitle = "TimerJobs"
    ...
}
catch { ... }
```

#### TrainerTrainee (lines 592-608):
```powershell
try
{
    # List TrainerTrainee
    $listTitle = "TrainerTrainee"
    ...
}
catch { ... }
```

---

### 1.4 WSP.UCC-7.ListContent.ps1 (List Content Population)

**File:** `Anywhere365/Scripts/WSP.UCC-7.ListContent.ps1`

**Remove the following sections:**

#### RetentionPolicy (lines 28-47):
```powershell
# RetentionPolicy
$listTitle = "RetentionPolicy"
...
$importFile = "$directory_ListContent\RetentionPolicy.csv" 
...
```

#### IDRQuestions (lines 172-190):
```powershell
# IDRQuestions
$listTitle = "IDRQuestions"
...
$importFile = "$directory_ListContent\$language\IDRQuestions.csv" 
...
```

---

### 1.5 Shared.ps1 (Lookup Fixes)

**File:** `Anywhere365/Scripts/Shared.ps1`

**Remove the following FixLookup calls (around lines 480-508):**

```powershell
# Remove these lines:
FixLookup $siteId $siteTitle "IDRQuestions" "IDRQuestions" "wsp_ucc_idr_parent"
FixLookup $siteId $siteTitle "IDRQuestions" "Skills" "wsp_ucc_idr_skill"
FixLookup $siteId $siteTitle "Notifications" "Skills" "wsp_ucc_not_skill"
FixLookup $siteId $siteTitle "TrainerTrainee" "Agents" "wsp_ucc_tt_trainer"
FixLookup $siteId $siteTitle "TrainerTrainee" "Agents" "wsp_ucc_tt_trainee"
```

---

### 1.6 Update Scripts

**Files in `Anywhere365/Scripts/Updates/Site/`:**

#### SiteUpdates_6.0.ps1:
- Remove TimerJobs references (lines 70-81)
- Remove RetentionPolicy references (lines 127-232)
- Remove TrainerTrainee view update (lines 304-305)
- Remove IDRQuestions field references (lines 333-334)
- Remove Notifications field references (line 343)

#### SiteUpdates_8.0.ps1:
- Remove Notifications section (lines 34-85)
- Remove BridgAuth section (lines 87-167)
- Remove "Survey" from scope choices (line 169)

#### SiteUpdates_6.3.ps1:
- Remove "Survey" from scope choices (line 369)

---

## 2. Folders to Delete

### 2.1 ListForms Folders

**Path:** `Anywhere365/ListForms/`

Delete these folders entirely:
- `BridgAuth/`
- `ChatQuestions/`
- `IDRQuestions/`
- `Notifications/`
- `RetentionPolicy/`
- `TimerJobs/`
- `TrainerTrainee/`

*(Survey list doesn't have a ListForms folder)*

---

## 3. CSV Files

### 3.1 Root CSV Files

**Path:** `Anywhere365/CSV/`

**Delete:**
- `RetentionPolicy.csv`

**Modify `SettingsList.csv`** - Remove these rows:
```csv
Trainer / trainee;/Lists/TrainerTrainee/AllItems.aspx;User settings;05;TRUE
Notifications;/Lists/Notifications/AllItems.aspx;Global settings;02;TRUE
Work jobs;/Lists/TimerJobs/AllItems.aspx;Global settings;09;TRUE
Chat questions;/Lists/ChatQuestions/AllItems.aspx;Functional settings;03;TRUE
IDR questions;/Lists/IDRQuestions/AllItems.aspx;Functional settings;07;TRUE
Survey;/Lists/Survey/overview.aspx;Functional settings;18;FALSE
```

### 3.2 Language-Specific CSV Files

**Path:** `Anywhere365/CSV/{Language}/`

**Delete from each language folder (Danish, Dutch, English, French, German, Italian, Norwegian, Portuguese, Spanish, Swedish):**
- `IDRQuestions.csv`

**Modify in each language folder - `SettingValues.csv`:**
Remove all rows with `Scope=Survey`:
- `EnableSurveyCreation`
- `EnableSurveyCreationInbound`
- `EnableSurveyCreationOutbound`
- `EnableSurveyCreationOutboundDialer`
- `SurveyConnectionString`
- `SurveyList`

---

## 4. JavaScript Files

### 4.1 Custom JS Files to Delete

**Path:** `Anywhere365/Assets/StyleLibrary/Anywhere365/Content/js/`

Delete these files entirely:
- `bridgauth.js`
- `chatquestions_custom.js`
- `idrquestions_custom.js`
- `notifications_custom.js`
- `retentionpolicy_custom.js`
- `timerjobs_custom.js`
- `trainertrainee_custom.js`

### 4.2 JavaScript Files to Modify

#### translate.js

**Path:** `Anywhere365/Assets/StyleLibrary/Anywhere365/Content/js/translate.js`

**Remove these lines:**
```javascript
if (typeof resource_menu_title_TrainerTrainee != "undefined" && resource_menu_title_TrainerTrainee != "") { $(".item-icon-trainertrainee a").html(resource_menu_title_TrainerTrainee); }
if (typeof resource_menu_title_Notifications != "undefined" && resource_menu_title_Notifications != "") { $(".item-icon-notifications a").html(resource_menu_title_Notifications); }
if (typeof resource_menu_title_TimerJobs != "undefined" && resource_menu_title_TimerJobs != "") { $(".item-icon-timerjobs a").html(resource_menu_title_TimerJobs); }
if (typeof resource_menu_title_IDRQuestions != "undefined" && resource_menu_title_IDRQuestions != "") { $(".item-icon-idrquestions a").html(resource_menu_title_IDRQuestions); }
if (typeof resource_menu_title_ChatQuestions != "undefined" && resource_menu_title_ChatQuestions != "") { $(".item-icon-chatquestions a").html(resource_menu_title_ChatQuestions); }
if (typeof resource_menu_title_RetentionPolicy != "undefined" && resource_menu_title_RetentionPolicy != "") { $(".item-icon-retentionpolicy a").html(resource_menu_title_RetentionPolicy); }
```

#### portal_data.js

**Path:** `Anywhere365/Assets/StyleLibrary/Anywhere365/Content/js/portal/portal_data.js`

**Remove TrainerTrainee retrieval (lines 220-240+):**
```javascript
retrieveTrainerTrainee();
// ... and entire function retrieveTrainerTrainee() and onQueryRetrieveTrainerTraineeSucceeded()
```

---

## 5. Resource Files

### 5.1 Language Resource Files

**Path:** `Anywhere365/Assets/StyleLibrary/Anywhere365/Content/resources/`

**Modify all `Resources.{locale}.js` files** (da-dk, de-de, en-us, es-es, fr-fr, it-it, nb-no, nl-nl, pt-pt, sv-se):

**Remove these variable declarations:**
```javascript
var resource_menu_title_TrainerTrainee = "...";
var resource_menu_title_RetentionPolicy = "...";
var resource_menu_title_TimerJobs = "...";
var resource_menu_title_ChatQuestions = "...";
var resource_menu_title_Survey = "...";
var resource_menu_title_IDRQuestions = "...";
var resource_menu_title_Notifications = "...";
```

---

## 6. Portal Page Updates

### 6.1 Portal HTML/ASPX

**Files:** 
- `Anywhere365/Pages/portal.aspx`
- `Anywhere365/Pages/Foundation2013/portal.aspx` (if kept)

**Remove menu items for:**
- TrainerTrainee (item-icon-trainertrainee)
- Notifications (item-icon-notifications)
- TimerJobs / Work jobs (item-icon-timerjobs)
- ChatQuestions (item-icon-chatquestions)
- IDRQuestions (item-icon-idrquestions)
- RetentionPolicy (item-icon-retentionpolicy)
- Survey (item-icon-survey)

---

## 7. Summary: Files to Delete

| File/Folder | Type |
|-------------|------|
| `Anywhere365/ListForms/BridgAuth/` | Folder |
| `Anywhere365/ListForms/ChatQuestions/` | Folder |
| `Anywhere365/ListForms/IDRQuestions/` | Folder |
| `Anywhere365/ListForms/Notifications/` | Folder |
| `Anywhere365/ListForms/RetentionPolicy/` | Folder |
| `Anywhere365/ListForms/TimerJobs/` | Folder |
| `Anywhere365/ListForms/TrainerTrainee/` | Folder |
| `Anywhere365/CSV/RetentionPolicy.csv` | File |
| `Anywhere365/CSV/*/IDRQuestions.csv` | Files (10 languages) |
| `Anywhere365/Assets/.../js/bridgauth.js` | File |
| `Anywhere365/Assets/.../js/chatquestions_custom.js` | File |
| `Anywhere365/Assets/.../js/idrquestions_custom.js` | File |
| `Anywhere365/Assets/.../js/notifications_custom.js` | File |
| `Anywhere365/Assets/.../js/retentionpolicy_custom.js` | File |
| `Anywhere365/Assets/.../js/timerjobs_custom.js` | File |
| `Anywhere365/Assets/.../js/trainertrainee_custom.js` | File |

---

## 8. Impact Summary

### Lists Being Removed: 8
- BridgAuth, BridgDocuments, ChatQuestions, Notifications, RetentionPolicy, Survey, TimerJobs, TrainerTrainee

> **Note:** IDRQuestions was initially planned for removal but has been **reinstated**.

### Content Types Being Removed: 6
- BridgAuth, ChatQuestion, Notification, RetentionPolicyItem, TimerJob, TrainerTraineeItem

> **Note:** IDRQuestion and IDRSystemItem content types are **retained**.

### Site Columns Being Removed: ~30+
- All `wsp_ucc_ba_*` fields (BridgAuth)
- All `wsp_ucc_cq_*` fields (ChatQuestions)  
- All `wsp_ucc_not_*` fields (Notifications)
- All `wsp_ucc_rp_*` fields (RetentionPolicy)
- All `wsp_ucc_tj_*` fields (TimerJobs)
- All `wsp_ucc_tt_*` fields (TrainerTrainee)

### Files to Delete: ~25
### Files to Modify: ~30+

### Estimated Code Reduction: 
- PowerShell: ~400-500 lines
- JavaScript: ~300 lines
- CSV data: ~200 lines
- Total: ~1,000 lines (approximately 15-20% of total codebase)

---

## 9. Testing Checklist

After implementing all changes:

- [ ] Script runs without errors
- [ ] Site collection creation succeeds
- [ ] UCC site creation succeeds
- [ ] Remaining lists are created correctly
- [ ] Remaining content types are applied
- [ ] Remaining views work correctly
- [ ] Portal page displays correctly (no broken menu items)
- [ ] No JavaScript console errors
- [ ] Lookup columns reconnect properly
- [ ] Settings and SettingValues lists don't show removed scopes
