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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Unlocking fields on Active Quote's

(5) ShareShare
ReportReport
Posted on by 55

Hi

Our users would like to edit some fields on the quote form while the quote is Active without having to re-open the Quote.

From my understanding only System Administrators can make changes to read-only records, as is implemented by Microsoft in the Microsoft.Dynamics.Sales.Plugins.PreOperationQuoteUpdate plugin.
Is there a way for me to unlock custom created fields while the quote is active, so users can only changes these specific fields?

I have the same question (0)
  • Suggested answer
    JDG Profile Picture
    58 on at
    You might be able to achieve this with a power automate flow where you use the "when a row is selected" trigger". This trigger offers the option of adding extra input fields. For example:
     
     
    You can of course create multiple flows to have more control over which fields. For example:"Flow 1: update Ship to Address" and "Flow 2: update Quote", where both flows use only one input field.
     
    When the flow is triggered, it can probably set the record to "Draft", change the specific fields (map the input fields to your custom fields) and then set it back to Active.
     
    Updating lookup fields will probably not work this way.
  • Krishna Acharya Profile Picture
    123 on at
    Hello  
     
    You're spot on — by design in Dynamics 365 Sales, Active Quotes are read-only for most users to maintain data integrity, and only System Administrators (or users with elevated privileges) can modify them. This is enforced by Microsoft's Microsoft.Dynamics.Sales.Plugins.PreOperationQuoteUpdate plugin.
    But yes — there are workarounds that allow updating specific fields on Active Quotes without reactivating the entire quote. Here's how you can approach it:
    Option 1: Use a Custom Plugin to Bypass the Default Validation
    You can register a custom plugin on PreOperation of Quote Update, and bypass the read-only restriction for specific fields.
    How it works:
    • In your plugin, check if the quote is in Active state.
    • Then check if only the allowed custom fields are being updated.
    • If so, use context.SharedVariables to short-circuit the OOB validation or just proceed without error.
    • This requires careful coding to avoid impacting Microsoft’s plugin logic.
     Important Note: You’ll also need to register your plugin before Microsoft’s plugin so your logic executes first.

    Option 2: Create a Custom Button/Panel + Power Automate or JavaScript
    If you want to keep it low-code, consider:
    • Adding a custom button or side panel to the Active Quote form.
    • Users can enter/edit values for the allowed fields.
    • Then use a Power Automate Flow or Web API call (JavaScript) to update those fields directly via API, bypassing UI restrictions.
    Since Power Automate runs in a service context, it isn't blocked by the UI restrictions (though the plugin may still apply).

    Option 3: Use Editable Grid / Quick View + Custom Entity
    Create a custom child entity (e.g., Quote Metadata) linked 1:1 with the Quote, with just those fields.
    • Embed it as a Quick View or Editable Grid on the Active Quote form.
    • Users can edit those fields even when the quote is "locked".
    • Use workflows/flows to keep it in sync if needed.

    What You Can't Do (Strictly):
    • You can’t just unlock specific fields via form customizations (like JavaScript setDisabled(false)) — the platform plugin still blocks saving for non-admins on Active Quotes.
    I used AI to help craft rephrases this response and share some useful tips for your Dynamics 365 challenge.
    If it’s helpful to you please Mark as verified !
    Thanks,
    Krishna
  • Suggested answer
    Daivat Vartak (v-9davar) Profile Picture
    7,835 Super User 2025 Season 2 on at
    Hello LabTeoV,
     

    Yes, you can definitely achieve this by bypassing the standard read-only behavior for specific custom fields on the Active Quote form for your users. Here's a breakdown of the approach and the steps involved:

    Understanding the Limitation:

    You are correct. By default, once a Quote transitions to an "Active" state, most of its fields become read-only due to the Microsoft.Dynamics.Sales.Plugins.PreOperationQuoteUpdate plugin. This is intended to maintain data integrity and prevent accidental modifications to finalized quotes.

    How to Unlock Specific Custom Fields:

    The most common and recommended way to achieve this is by implementing custom JavaScript on the Quote form. You can write JavaScript code that executes on form load and conditionally unlocks your specific custom fields based on the Quote's status.

    Steps:

    1. Identify the Custom Fields: Note down the exact schema names of the custom fields you want to make editable on the Active Quote form.

       

    2. Create a JavaScript Web Resource:

       

      • Go to Settings > Customizations > Customize the System > Web Resources.

      • Click New.

      • Give it a meaningful name (e.g., quote_unlock_custom_fields.js).

      • Set the Type to "Script (JScript)".

      • Click Text Editor and paste the JavaScript code (provided below).

      • Save and Publish the Web Resource.

    3. Add the Web Resource to the Quote Form:

       

      • Go to Settings > Customizations > Customize the System > Entities > Quote > Forms.

      • Open the main Quote form you want to modify.

      • Go to the Insert tab on the form editor.

      • Click Web Resource.

      • In the "Add Web Resource" dialog:

        • In the "Web resource" lookup, find and select the JavaScript Web Resource you just created.

        • Give it a meaningful name (e.g., unlockCustomFieldsScript).

        • Uncheck the "Visible" option (so the web resource container itself isn't displayed).

        • Click OK.  

    4. Configure an OnLoad Event Handler:

       

      • With the Web Resource selected on the form, go to the Events tab in the form editor.

      • In the "Form Libraries" section, you should see your added Web Resource.

      • In the "Event Handlers" section, click Add.

      • Set the Event to "OnLoad".

      • In the "Handler" section:

        • Select your Web Resource from the "Library" dropdown.

        • Enter the name of the JavaScript function you'll define in the Web Resource (e.g., unlockActiveQuoteFields).

        • Uncheck "Pass execution context as first parameter".

        • Click OK. 

      • Save and Publish the Quote form.


      •  

    JavaScript Code Example (quote_unlock_custom_fields.js):

    function unlockActiveQuoteFields(executionContext) {
        var formContext = executionContext.getFormContext();
        var stateCode = formContext.getAttribute("statecode").getValue(); // Get the Quote's State (Active = 1)
        // Array of the schema names of your custom fields to unlock
        var customFieldsToUnlock = ["new_customfield1", "new_customfield2", "tcg_anothercustomfield"]; // Replace with your actual schema names
        if (stateCode === 1) { // If the Quote is Active
            customFieldsToUnlock.forEach(function(fieldName) {
                var control = formContext.getControl(fieldName);
                if (control) {
                    control.setDisabled(false); // Enable the control (unlock the field)
                }
            });
        }
    }

     

    Explanation of the JavaScript Code:

    • unlockActiveQuoteFields(executionContext): This is the function that will execute when the Quote form loads.

    • var formContext = executionContext.getFormContext();: Gets the form context.

    • var stateCode = formContext.getAttribute("statecode").getValue();: Retrieves the current state code of the Quote. The value 1 typically represents the "Active" state. Verify the actual state code value for "Active" in your system.

    • customFieldsToUnlock: This array holds the schema names of the custom fields you want to unlock. Replace the placeholder schema names with the actual schema names of your custom fields.

    • if (stateCode === 1): This condition checks if the Quote's state is "Active".

    • customFieldsToUnlock.forEach(...): This loop iterates through each custom field name in the array.

    • var control = formContext.getControl(fieldName);: Gets the control object for the current custom field.

    • if (control): Checks if the control exists on the form.

    • control.setDisabled(false);: This line unlocks the field, making it editable.


    •  

    Important Considerations:

    • State Code Value: Ensure that the value 1 in the JavaScript code correctly represents the "Active" state of your Quote entity. You can verify this by looking at the state code options for the Quote entity in the customization area.

    • Schema Names: Double-check and ensure you are using the correct schema names (the internal, programmatic names) of your custom fields, not their display names.

    • User Training: Inform your users about which fields they can now edit on Active Quotes.

    • Data Integrity: Carefully consider the implications of allowing edits to Active Quotes. Ensure that these specific custom fields are appropriate for modification after activation and won't negatively impact reporting or downstream processes.

    • Alternative Approaches (Less Recommended for This Scenario):

      • Modifying the Plugin (Unsupported): Directly altering the behavior of the Microsoft.Dynamics.Sales.Plugins.PreOperationQuoteUpdate plugin is highly discouraged as it's an unsupported customization and can break during updates.

      • Custom Workflow/Plugin on Update: While you could potentially create a workflow or plugin that runs on the update of the Quote and unlocks fields, client-side JavaScript provides a more immediate user experience.

      •  

    By implementing the JavaScript approach outlined above, you can selectively unlock your custom fields on the Active Quote form, allowing your users to make necessary modifications without having to revert the Quote to a draft state. Remember to test thoroughly after implementing these changes.

     
    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
  • LabTeoV Profile Picture
    55 on at
    Thank you all for the replies. As i'm definitely not into the creation of plugins yet i will go ahead and try the javascript first. I think i have already tried one before but it could've been a wrong code.

    The PowerAutomate won't work for us if it's setting the Quote back to Draft, this defeats the purpose of what i'm looking for. Once i have tried the options given i will mark come back and make sure to close the topic.
     
  • Suggested answer
    Tom_Gioielli Profile Picture
    2,762 Super User 2025 Season 2 on at
    I'll start by saying that I typically try to avoid using a plugin or JavaScript in a situation like this. To me it feels a bit like fighting against the system, when other options can be much more simple.
     
    I do really like @JDG's suggestion for a Cloud Flow with manual inputs. I do have one more alternative to propose.
     
    ----------------------------------------------------------------
    Quote can be either in a Draft, Active, or Closed state. Active and Closed are both read-only as the default behavior, and MS does not give us configuration options to disable this.
     
    Instead of fighting against this behavior, just bypass it completed. Add a new Status Reason to the "Draft" State that indicates the quote has been sent to a customer. This prevents the quote from being locked down, and you can even control which fields are editable or not through a simple business rule. This prevents the need to write and maintain code or assume technical debt by trying push back against system behavior that I don't see changing anytime soon.
     
    Just another option if you are looking for choices. Best of luck!
     
     
  • LabTeoV Profile Picture
    55 on at
    So the Javascript doesn't seem to work. I get the following error; "Cannot read properties of undefined (reading 'getFormContext')"
     
    The only thing that removes this error is ticking the "pass execution context as first parameter" but then the script doesn't work and the fields are still locked.

     
    I've followed all steps but the one above since it wouldn't allow me to add the web resource this way. Since i'm using Power Apps, i added the library and then added the Event handler under the On Load section. Ofcourse changed the custom fields names and checked if Active has the code "1"
     
    Is there anything i'm missing, because right now i'm getting the exact same error message
     
     
    I prefer to use the JS over a flow because it allows for our users to avoid extra steps, which they most likely won't take. It's a simple field that allows us to see the probability of a quote succeeding. 
     
    Any suggestions on how to fix this error are appreciated :)
  • Verified answer
    Tom_Gioielli Profile Picture
    2,762 Super User 2025 Season 2 on at
    Got an update on this item and saw the response. Not sure if other folks will come back to help with their code suggestions, but the error you are receiving is a good indicator that even when you try to unlock fields with JavaScript it does not stop validation at the database level that prevents an Active quote from being modified.
     
    I would again strongly recommend my resolution below, which bypasses all of those problems entirely and does not require any separate code, flows, or other automations. Just adding in a new status reason and some business rules.
     
     
    Instead of fighting against this behavior, just bypass it completed. Add a new Status Reason to the "Draft" State that indicates the quote has been sent to a customer. This prevents the quote from being locked down, and you can even control which fields are editable or not through a simple business rule. This prevents the need to write and maintain code or assume technical debt by trying push back against system behavior that I don't see changing anytime soon.
  • LabTeoV Profile Picture
    55 on at
    @Tom_Gioielli I will definitely look into this option. I'm thinking of the best way to implent this, as the user will have to change the status and once done editing would have to change it back from Draft - Approved (or w/e the status reason will be) to Active - Approved.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans