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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Remove Optionset from a column in Editable subgrid

(0) ShareShare
ReportReport
Posted on by 10

Hello , 
I have requirement to remove options from optionset on click of a record through JS . 
Example I have a column "Status" whose values are A , B  ,C , D .
On select of a record I would like to show only A & B in the editable grid.

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Please try Remove option code to remove option from your field

    docs.microsoft.com/.../removeoption

  • Medidhi Profile Picture
    10 on at

    Thanks for your reply .I have tried  this  , its not working in case of Editable Subgrid .

    pastedimage1657280579352v1.png

  • Ray Profile Picture
    1,537 on at

    The gridContext is different with the formContext. If you are trying to access some control/attribute in grid, you should use gridContext rather than formContext.

  • Ray Profile Picture
    1,537 on at

    Accoding to my research, this is not a doable requirement.

    There are fewer methods/events you can access in grid control, compare with formContext control. You can see detail with GridAttribute.

    Also here is my test result:

    "executionContext" is the gridContext. "new_source" is an optionset field but it does not have the removeOption() method.

    function onRowSelected(executionContext){
        debugger;
        executionContext.getFormContext().data.entity.attributes.forEach(attribute => {
            if(attribute.getName() == 'new_source'){
                attribute.controls.get(0).removeOption(100000001);
            }
        });
    }

    WeChat-Screenshot_5F00_20220808135358.png

    Also you can read more about Grid.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
NeerajPawar Profile Picture

NeerajPawar 31

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 23 Super User 2026 Season 1

#3
Encore Business Solutions Profile Picture

Encore Business Sol... 14

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans