web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

How can I add an attachment on the Lead before saving the page?

(2) ShareShare
ReportReport
Posted on by 250
Hello
 
How can I add an attachment to the Lead before saving the page?
 
Currently, when I convert a lead to the qualify stage, I’m required to fill in the details and save the page first. Only after saving does the attachment section (notes or documents) become available. However, I need the attachment functionality to be available before the page is saved, so users can upload documents prior to qualification.

Any help would be greatly appreciated!

I have the same question (0)
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    18,966 Super User 2025 Season 2 on at
  • Suggested answer
    Daivat Vartak (v-9davar) Profile Picture
    7,827 Super User 2025 Season 2 on at
    How can I add an attachment on the Lead before saving the page?
    Hello Jinal P.,
     

    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.

     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Regards,
    Daivat Vartak

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 147

#2
DAnny3211 Profile Picture

DAnny3211 134

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans