Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Field.IsReadOnly does not work properly on lookup attributes #963

Closed
4 of 12 tasks
Fietlux opened this issue Sep 4, 2020 · 1 comment · Fixed by #985 or #947
Closed
4 of 12 tasks

[BUG] Field.IsReadOnly does not work properly on lookup attributes #963

Fietlux opened this issue Sep 4, 2020 · 1 comment · Fixed by #985 or #947
Labels
Milestone

Comments

@Fietlux
Copy link

Fietlux commented Sep 4, 2020

Bug Report

Issues should only be created for items related to covered functionality.

Not covered functionality, feature requests, and questions should use the Feature Request or Question templates.

EasyRepro Version

  • Microsoft Dynamics 365 Online Version 8.2 (8.2.x) (DB 8.2.x) online
  • Microsoft Dynamics 365 Online Version 9.0 (9.0.x) (DB 9.0.x) online
  • Microsoft Dynamics 365 Online Version 9.0.2 (9.0.2) (DB 9.0.2) online
  • Microsoft Dynamics 365 Online Version 9.1 (9.1.x) (DB 9.1.x) online

UCI or Classic Web

  • UCI (XrmApp)
  • Classic Web (XrmBrowser)

Online or On Premise

  • Online
  • On Premise

Browser

  • Chrome
  • Firefox
  • IE
  • Edge

Describe the bug
Some attributes should become (non-)mandatory/readonly/writeable depending of another field.
After clearing the initiating field all of them should switch back to their previous state.
Our UI test should check both situations but the Field.IsReadOnly property always returns false.
The form is displaying the expected state correctly.

Special formatting / display
none

Code to reproduce

            //Set ProductCode and check if Business Unit and Operating Unit were locked
            this.SetLookupValue(Metadata.Lead.ProductCode, "1A Ammonia");
            //wraps App.Entity.SetValue(new LookupItem ...

            this.ClearFocus();
            App.ThinkTime(2000);

            IsFieldReadOnly(Metadata.Lead.BusinessUnit, true); // does not work properly
            IsFieldReadOnly(Metadata.Lead.OperatingUnit, true); // does not work properly

...

        public void IsFieldReadOnly(string attributeName, bool expectedValue)
        {
            this.TestContext.WriteLine("IsFieldReadOnly: {0}", attributeName);
            Field field = this.App.Entity.GetField(attributeName);

            if (expectedValue)
            {
                Assert.IsTrue(field.IsReadOnly);
            }
            else
            {
                Assert.IsFalse(field.IsReadOnly);
            }
        }

Expected behavior
Field.IsReadOnly (also IsRequired and IsVisible) should return the current state that is displayed on the form.

Screenshots
Previous state
image
After setting "Product Code"
image
Result of Assert
image

Additional context
In this case it occurs on lookup fields only. The depending field is the "Product Code", that should lock both fields above if set.

@Fietlux Fietlux added the bug label Sep 4, 2020
@Fietlux
Copy link
Author

Fietlux commented Sep 4, 2020

In another case a lookup is initially readonly. The first request of Field.IsReadOnly works fine. After switching to writeable and back to readonly Field.IsReadOnly does not return the correct state for the lookup. All other fields that are not of type lookup are working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants