Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Unable to filter Option Set values in Dynamics 365 Editable Grid

Posted on by 25

I just want to filter the OptionSet field (B) options onChange of another field (A), function is triggering but I am unable to find the getOptions, clearOptions methods in the field like we have in Form level. Can anyone please help me out ?

Thanks!

*This post is locked for comments

  • Akash1ve Profile Picture
    Akash1ve 10 on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    is anyone found this answer ? i am in same boat

  • Pri01 Profile Picture
    Pri01 10 on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    Has anyone found a soln for this issue? Please let me know

  • Suggested answer
    Shiva K Profile Picture
    Shiva K 40 on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    Hi All,

    Can you try coding like below ....

    function EditableGridMainReasonHide(context) {

    debugger;

    LockFieldsOnEidtableGrid(context, ["xxxx"]);

    }

    LockFieldsOnEidtableGrid = function(context, disableFields)

    {

    var currEntity = context.getFormContext().data.entity;

    currEntity.attributes.forEach(function (attribute,i){

    if(disableFields.indexOf(attribute.getName())>-1)

    {

    var attributeToDisable = attribute.controls.get(0);

    attributeToDisable.clearOptions();

    }

    });

    }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    Hi

    No sorry I didn't find any solution.

  • Shiva K Profile Picture
    Shiva K 40 on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    Hi Sapet.

    Did you found solution? to remove or Clear Options from Option Set in Editable Grid?

    Am also in same boat what to clear some options on Row Select Event.  :(

    Regards,

    Shiva K

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    Hello,

    I have the same issue. Does everyone have an idea ?

    Thanks

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    I'm getting the same issue... Could it be related to CRM 8.2.2 version on-prem? My issue is in Version 1612 (8.2.2.112) (DB 8.2.2.112) on-premises. Any ideas on why the behavior is not as in the Client API documentation (https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/controls/removeoption)?

    To add, I'm able to get the OptionSet options using:

    var myOptionSetAttr = executionContext.getFormContext().data.entity.attributes.getByName("my_optionsetname");

    var options = myOptionSetAttr.getOptions();

    In this case getOptions() returns correct number of the options and their values. removeOption and clearOptions also do NOT throw exceptions if executed on the myOptionSetAttr. But they do NOT take any effect on the actual option set in the editable subgrid.

    At the same time after getting "optionset control" like this:

    var myOptionSetCtrl = executionContext.getFormContext().data.entity.attributes.getByName("my_optionsetname").controls.getByIndex(0);

     calling getOptions(), removeOption() or clearOptions() throws the exceptions.

    Calling:

     executionContext.getFormContext().getControl("my_optionsetname");

    throws exception "Object doesn't support property or method 'getControl'".

  • PraveenCRM365 Profile Picture
    PraveenCRM365 25 on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    5076.Error1.png

    Sorry :( . It didn't worked. I think there will be some difference in-between Form's Context and Editable Grid's Context . I am not seeing any methods such clearOptions, removeOptions for the Optionset control in Editable Grid's Context but I can see SetDisabled, GetDisabled methods (snip below)

    5076.Error1.png

  • Suggested answer
    Preeti Sharma Profile Picture
    Preeti Sharma 2,678 on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    Hi,

    I guess you  may  need to get executioncontext first and then try to get control as you get fields over there.

    Below is the exact syntax that should work:

    formContext.getControl(arg).clearOptions();

    In your quaery it can be:

    executionContext.getFormContext().getControl("cpt_optionset1").clearOptions();

    You can check below link for same:

    docs.microsoft.com/.../removeoption

    Hope this helps! :)

  • PraveenCRM365 Profile Picture
    PraveenCRM365 25 on at
    RE: Unable to filter Option Set values in Dynamics 365 Editable Grid

    Sorry! Its doesn't work

    TypeError: executionContext.getControl is not a function

    Thanks!

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans