Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Unlock fields in editable grid

(1) ShareShare
ReportReport
Posted on by 83
Hi,

Is it possible to make every field editable in editable grid? for example I have created a custom field and on the editable grid it shows as locked.
  • Suggested answer
    Unlock fields in editable grid
    Hi John,
     
    This can be done with Javascript. 
    In your js file , copy this function :
     
    function lockUnlockFields(executionContext,fieldName,lockunlock) {
          var formContext = executionContext.getFormContext();
              let objEntity = formContext.data.entity;
              objEntity.attributes.forEach(function (attribute, i) {
                     if (attribute.getName() == fieldName) {
                        let attributeToDisable = attribute.controls.get(0);
                        attributeToDisable.setDisabled(lockunlock);
                     }
              });
    }
    Then, create a function to unlock a list of fields of your choice , for example :
     
    function unlockMyFields(executionContext)
    {
        var formContext = executionContext.getFormContext();
        
        var fieldNames = ['unit','discountpercentage'];//put here the logical names of the fields to unlock
        for(i=0;i < fieldNames.length;i++)
        {
            lockUnlockFields(executionContext,fieldNames[i],false);
        }
    }
    Now, you have to qo to the opportunity form , select the subgrid of the products and in the events tab , choose the event 'OnRecordSelect'  and put your function there (unlockMyFields).
     
    Regards,
     
    Mounir
     
  • Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Unlock fields in editable grid
    Hi Partner,
    Was my answer helpful? 
    If it was helpful, can you verify it?
    If you have any questions, please feel free to contact me.
    Regards,
    Leah
  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Unlock fields in editable grid
    Hi John,
    Because it's by-design, it's impossible to change it.
    Perhaps you could add another editable sub-grid yourself, rather than using the OOB sub-grid, , then you can edit columns in the new subgrid:
  • John Mongol Profile Picture
    John Mongol 83 on at
    Unlock fields in editable grid
    My question is not about the design, but if its possible to make them not restricted somehow? 
  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Unlock fields in editable grid
    Hi Partner,
    Yes, this is by-design.
    There are certain restrictions on inline editing based on the type of products in the subgrid:
    - If the product in the subgrid is an individual product and an existing product from the product catalog, all fields except the Quantity and Discount are locked for editing.
    - If the product in the subgrid is an individual product and a write-in product from the product catalog, all fields except the Product Name, Quantity, and Discount are locked for editing.
    - If the product in the subgrid is a product bundle or an optional product of a bundle, all fields except Quantity and Discount are locked for editing.
    - If the product in the subgrid is a required product from an existing product bundle, all fields in the subgrid view are locked for editing.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans