# Understanding the Backend Automation

So you've got SharePoint for your assets and Business Central for your data. But what actually connects them to the website? That's where the custom backend system comes in. Let's break down how it all works.

***

### The Big Picture

The backend system is the automation layer that monitors both SharePoint and Business Central for changes. When it detects a triggered event (like you adding a new product folder or updating an item attribute), it processes that change and syncs it to the Lib\&Co website automatically.

**You don't manually publish anything.** Make your changes in the right place, and the system handles the rest.

***

### How Triggered Events Work

The backend constantly monitors for specific events across your platforms:

#### SharePoint Triggers

**What the system watches for:**

* New folders created (collections or products)
* Files uploaded or modified (images, videos, catalogues, PDFs)
* Files deleted or moved
* Folder structure changes

**What happens:** When you create a product folder and upload images, the backend detects this as a triggered event. It processes the new assets, validates the structure, and prepares them for the website.

***

#### Business Central Triggers

**What the system watches for:**

* New items created
* Item attributes added or modified (especially the 2 critical attributes)
* Product names changed
* Item configurations updated

**What happens:** When you configure item attributes or update product details, the backend captures this data and maps it to the corresponding website elements. Connecting products to collections, updating specs, refreshing display names.

***

#### The Synergy Effect

Here's where it gets powerful: the backend creates synergy across Business Central, SharePoint, databases, and servers. It doesn't just watch one platform. It correlates data across all of them.

**Example workflow:**

1. You create a product folder in SharePoint with images
2. Backend detects the new folder (triggered event)
3. You configure item attributes in Business Central
4. Backend detects the attribute changes (triggered event)
5. System matches the SharePoint assets with the BC data
6. Everything syncs to the website as a complete product

The platforms work together, not separately.

***

### What Happens When You Make a Change

Let's walk through the automation sequence:

#### Step 1: You Make a Change

You create a folder, upload a file, or update an attribute in SharePoint or Business Central.

#### Step 2: Backend Detects the Event

The monitoring system picks up the triggered event. Usually within a minute or two of your change.

#### Step 3: Validation & Processing

The backend validates your change:

* Is the folder structure correct?
* Are required files present?
* Do the attributes match expected formats?
* Is the data complete across both platforms?

#### Step 4: Database Updates

If validation passes, the system updates the relevant databases with your new or modified data.

#### Step 5: Website Sync

The processed changes get pushed to the website. The sync happens automatically.

#### Step 6: Live on Site

Your changes appear on the Lib\&Co website. Refresh the page and you'll see them.

**Total time:** Typically 10-15 minutes from when you make the change to when it's live on the website.

***

### What's Automatic vs What You Control

#### Fully Automatic (System Handles It)

✅ **Detecting your changes** - You don't need to notify the system

✅ **Data validation** - System checks for errors automatically

✅ **Cross-platform syncing** - SharePoint + BC data gets matched

✅ **Database updates** - Backend manages all database write

✅ **Website publishing** - Changes go live without manual approval

✅ **Asset optimization** - Images get processed and optimized

✅ **Error logging** - Issues get tracked automatically

#### You Control (Manual Setup Required)

🔧 **SharePoint folder creation** - You create the folders and structure

🔧 **Asset uploads** - You add images, videos, catalogues manually

🔧 **Business Central configuration** - You set item attributes and details

🔧 **Data accuracy** - You ensure names, specs, and mappings are correct

🔧 **File naming conventions** - You follow required naming patterns

🔧 **Asset quality** - You provide high-quality source files

***

### Sync Timing & Expectations

**How long does it take for changes to appear?**

Most changes sync within **10-15 minutes**, but here's the breakdown:

| Change Type          | Typical Sync Time |
| -------------------- | ----------------- |
| New product folder   | 10-15 minutes     |
| Image uploads        | 10-15 minutes     |
| Attribute updates    | 10-15 seconds     |
| Product name changes | 10-15 minutes     |
| Video uploads        | 10-15 minutes     |
| Collection updates   | 10-15 minutes     |

**Factors that affect timing:**

* File size (larger videos take longer)
* Number of simultaneous changes
* Server load at time of change
* Complexity of data validation required

**Pro tip:** After making a change, give it 10-15 minutes and then refresh the website. If it's still not showing, check the troubleshooting guide.

***

### Why Sequential Order Isn't Enforced

Here's something important: you don't have to complete SharePoint setup before moving to Business Central, or vice versa. The sequential order isn't strictly enforced as long as the required data is eventually available across both platforms.

**This means:**

✅ You can upload product images to SharePoint before configuring attributes in BC\
✅ You can set up item attributes in BC before the SharePoint folder exists\
✅ You can work in whichever platform has the data ready first\
✅ The backend will sync once both sides are complete

**What matters:** Both platforms eventually have the required data. The order you complete them doesn't matter. The system will connect the dots when everything's in place.

**Example:**

* Monday: Configure product attributes in Business Central (nothing syncs yet)
* Tuesday: Create SharePoint folder and upload images
* Backend: Detects both are now complete, matches them together, syncs to website

Flexible workflow, automatic syncing.

***

### The Database & Server Layer

Behind the scenes, the backend manages databases and servers that store and process all your data:

**What the databases hold:**

* Product catalog data
* Collection mappings
* Asset file paths and metadata
* Sync status and logs
* Configuration settings

**What the servers do:**

* Host the monitoring system
* Process triggered events
* Run validation checks
* Execute sync operations
* Serve data to the website

You don't interact with these directly. The backend handles all database writes and server operations automatically.

***

### Error Handling & Recovery

The system is built to handle issues gracefully:

**Common scenarios:**

**Missing required files**

* Backend detects incomplete setup
* Change doesn't sync until all requirements are met
* No partial/broken products appear on the website

**Invalid data formats**

* System flags formatting errors in validation
* Change is held until corrected
* Check troubleshooting guide for format requirements

**Conflicting changes**

* Last change wins (most recent update takes precedence)
* System logs all changes for tracking
* Can review history if needed

**Server/connection issues**

* Backend retries failed operations automatically
* Changes queue until connection restores
* No data loss during temporary outages

***

### Monitoring Your Changes

**How to verify sync happened:**

1. **Check the website** - Refresh the page and look for your changes (wait 10 minutes first)
2. **Review in SharePoint** - Confirm files are in correct locations with proper naming
3. **Verify in Business Central** - Double-check attributes and data are configured correctly
4. **Look for errors** - If something's not syncing, check the troubleshooting guide

**No sync dashboard exists** (currently) - verification is manual by checking the website itself.

***

### Best Practices for Working With the System

**To make the automation work smoothly:**

✅ **Follow naming conventions** - System looks for exact file names

✅ **Use correct folder structures** - Assets must be in expected locations

✅ **Complete both platforms** - Don't leave setup half-done indefinitely

✅ **Validate your data** - Check formats before saving in BC

✅ **Give it time** - Don't assume instant sync, wait 10 minutes

✅ **Check the website** - Always verify changes went through

✅ **Use the guides** - Follow step-by-step instructions for each task

**Avoid these mistakes:**

❌ Don't rename folders after creation (breaks references)

❌ Don't use special characters in file names

❌ Don't skip required attributes in Business Central

❌ Don't expect instant sync

***

### Common Questions

**Q: Can I force a manual sync?** No, the system handles all syncing automatically. You can't trigger it manually.

**Q: What if I make a mistake?** Update the incorrect data in SharePoint or BC. The backend will detect the change and sync the correction.

**Q: Can I see sync status somewhere?** Not currently. Verify by checking the website after 10 minutes.

**Q: What if changes don't appear after 15 minutes?** Check the troubleshooting guide. Likely a missing requirement or formatting issue.

**Q: Does the system work 24/7?** Yes, the backend monitors continuously. Make changes anytime.

***

### Related Guides

Now that you understand how the backend works, dive into specific tasks:

* [**Your First Steps**](https://libandcodocs.codewavestudio.com/getting-started/your-first-steps) - Get oriented with the system
* [**Add a New Product**](https://libandcodocs.codewavestudio.com/managing-products/add-a-new-product) - Complete workflow from both platforms
* [**Item Attributes Quick Reference**](https://libandcodocs.codewavestudio.com/business-central-setup/item-attributes-quick-reference) - The critical BC configuration
* [**Troubleshooting Common Issues**](https://libandcodocs.codewavestudio.com/troubleshooting-and-help) - When things don't sync as expected

***

**Bottom line:** The backend automation is designed to make your life easier. You focus on creating great content and configuring data correctly. The system handles everything else. Once you know where things go and how to structure them, the automation just works.
