Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Sales forum / Unlock fields in edita...
Sales forum
Suggested answer

Unlock fields in editable grid

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.
Categories:
  • 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.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans