You're right, the standard behavior in Dynamics 365 (and the Unified Interface) is to only enable the Timeline (where notes and attachments reside) after a record has been saved and has a unique ID. This is because attachments need to be linked to a specific record in the database.
However, there are a few workarounds and approaches you can take to make attachment functionality available on the Lead form before it's saved:
1. Using a Custom PCF Control for Pre-Save Attachments (Recommended for Modern UI):
This is the most modern and user-friendly approach, but it requires development skills. You can create a Power Apps component framework (PCF) control that allows users to upload files and temporarily store them before the Lead record is saved. Once the Lead is saved, the PCF control can then associate these temporarily stored files as Notes with attachments or Documents (SharePoint integration) to the newly created Lead record.
- How it Works:
- The PCF control would provide an interface for users to select and upload files.
- The control would store these files in the browser's local storage or a temporary holding area.
- When the user clicks the "Qualify" button (or a custom "Save and Qualify" button), your custom JavaScript (or logic within the PCF) would:
- Save the Lead record.
- Retrieve the uploaded files from the temporary storage.
- Use the Dynamics 365 Web API to create Note records with the attachments or upload the files to SharePoint and create Document Location/Document records linked to the Lead.
- Clear the temporary storage.
- Advantages:
- Provides a seamless user experience within the form.
- Leverages modern Dynamics 365 development capabilities.
- Offers flexibility in how the attachments are stored (Notes or SharePoint).
- Disadvantages:
- Requires development expertise in PCF.
- Involves managing temporary storage and the logic for associating files after the save.
2. Creating a Separate "Draft" Entity and a Canvas App (More Complex):
You could create a separate "Lead Draft" entity with fields similar to your Lead entity, including a file upload component (like the Attachments control in a Canvas App). Users would initially interact with this "Lead Draft" form and upload attachments there. Upon qualification, a Power Automate flow or custom code would:
- Create the actual Lead record, copying data from the "Lead Draft."
- Retrieve the attachments from the "Lead Draft" record.
- Create Note records with attachments or Document records linked to the newly created Lead.
- Potentially delete the "Lead Draft" record.
- Advantages:
- Allows for pre-save attachments using the built-in capabilities of Canvas Apps.
- Provides a clear separation for draft records.
- Disadvantages:
- More complex to set up and manage two entities.
- Adds an extra step for users.
- Requires users to navigate to a Canvas App interface initially.
3. Using a Custom Web Resource with JavaScript (Classic Interface - Less Ideal for Modern UI):
If you are still using the Classic Interface (though it's highly recommended to transition to the Unified Interface), you could embed a custom HTML web resource with JavaScript on the Lead form. This web resource could provide file upload functionality. The JavaScript would need to:
- Handle file uploads and potentially store them temporarily (e.g., using browser APIs or a temporary storage service).
- When the Lead is saved (or a custom "Save and Attach" button is clicked), the JavaScript would use the Dynamics 365 Web API to create Note records with the uploaded files.
- Advantages (in Classic):
- Allows for pre-save attachment functionality within the form.
- Disadvantages:
- Less integrated with the modern Unified Interface look and feel.
- Requires JavaScript development.
- Involves managing temporary storage and API calls.
Why the Standard Behavior Exists:
The standard behavior of enabling the Timeline after saving is due to the relational database structure. Attachments (Notes with files or Documents) need a parent record (the Lead) to be associated with. Until the Lead record has a unique ID (assigned upon saving), there's no stable place to link the attachments.
Recommendation:
For the Unified Interface, the Custom PCF Control approach (Option 1) is the most recommended as it provides the best user experience and leverages modern Dynamics 365 development practices.
If you are on the Classic Interface and not planning a migration immediately, the Custom Web Resource with JavaScript (Option 3) could be considered, but it's a less future-proof solution.
The Separate "Draft" Entity and Canvas App (Option 2) is a more complex workaround and might not be the most intuitive for users in a typical Lead qualification process.
Unfortunately, there isn't a simple configuration setting to enable pre-save attachments directly on the standard Lead form. You will need to implement one of these custom solutions. Remember to thoroughly test any custom solution in a non-production environment before deploying it to production.