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
is anyone found this answer ? i am in same boat
Has anyone found a soln for this issue? Please let me know
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();
}
});
}
Hi
No sorry I didn't find any solution.
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
Hello,
I have the same issue. Does everyone have an idea ?
Thanks
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'".
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)
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! :)
Sorry! Its doesn't work
TypeError: executionContext.getControl is not a function
Thanks!
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156