khoait / DCE.PCF

Power Apps PCF Controls Repository
GNU General Public License v3.0
49 stars 12 forks source link

Lookdown control doesn't work with the form editor #131

Open RainCityAndrew opened 2 months ago

RainCityAndrew commented 2 months ago

Component

Lookdown v1.2.0

Describe the bug

Control doesn't work when added to field using new power apps form editor.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to a form in powerapps form editor
  2. Add the component to a lookup field
  3. using default setting save form and publish
  4. Refresh a record and control doesn't work. Can't click on or interact with the field.
  5. Open the form in the old school form editor and open the field without changing anything hit "ok", save, publish
  6. Open the same record and refresh and the component now works great

Expected behavior

To be addable from the new form editor since the old editor is mostly deprecated and difficult to use

Actual behavior

A clear and concise description of what you experienced.

Screenshots

image

This is how the control looks after saving it in the old school editor. Label is invisible but it works on the record as shown below.

image

Additional context

I switched to a different PCF control with similar functionality and this was noted as a bug which brought me back to test if it's the same case here https://github.com/drivardxrm/LookupDropdown.PCF/issues/29

khoait commented 2 months ago

Thanks for reporting! I will look into this and get back to you.

wenstarner commented 2 months ago

Hello, just to add that I experienced this today! I was very confused, as I had no reason to believe that the new editor wouldn't work.

I have used the old form editor for this control. Which is not a problem of course, but worth flagging with you, Khoa. Cheers

khoait commented 2 months ago

@wenstarner thanks for your input! it looks strange! could be a bug in the modern form editor. It doesn't happen for me though. can you try removing the field from the form > save and publish > close the form > open the form and add the field > add Lookdown component again? @RainCityAndrew @wenstarner just to check if the problem is fixed by MS already and we can refresh the field metadata by removing and adding it back.

wenstarner commented 2 months ago

Hi, I followed your steps and it's not working again. So strange!

Yesterday, I tried many times without luck (in the new form editor). To confirm, this time just now, I've followed your instructions exactly, and closed the tab with the modern form editor, and opened a new tab to load it up again. Please let me know if there's anything else I can do to help.

wenstarner commented 2 months ago

Sorry to double-post, but a small update:

  1. As mentioned in my last post, I removed the component and then re-added it in the modern editor. It didn't work, just like last time. The component renders, but clicking does nothing.
  2. I kept the 'non-working' component in the form, and then opened up the classic editor. I changed a single setting, being the 'group by' option.
  3. I saved and published (again, in the classic editor), and now the component works. But the group text is in black, whereas that same text was blue (correctly?) when I had added the component initially via the classic editor. Here is a screenshot, showing the black group labels:
image

I thought this was a glitch, so removed and then re-added the component in the classic editor. And now the group labels continue to display in black... not a problem, but another thing I thought useful to point out.

EDIT: I updated a few further settings (without removing the component), and the group labels are blue again:

image
khoait commented 2 months ago

thanks @wenstarner! so there must be differences in metadata between the two editors 🤔. I'll create a new environment and try it again.

RainCityAndrew commented 2 months ago

I'll add that I tested all the ways mentioned here and have the same results of getting it to work by changing or applying a setting in the old editor. I'm using Firefox if that might make a difference.

Also a side note, it's not possible to completely null the option once one is entered

khoait commented 2 months ago

Ok I'm able to replicate it. it's obviously because of the modern editor. there are missing metadata, which are needed within the control such as Default View Id, when a lookup field is added in the modern editor. see images below

Lookup field when added in Classic Editor fieldbyclassic

Lookup field when added in Modern Editor fieldbymodern

we can use classic editor to add the field, but one problem is when we open the form in modern editor, the control label is missing. the form is still working fine for end users but it doesn't look right in the modern editor.

now I found a workaround for the missing metadata. in modern editor:

  1. first add the lookup field,
  2. change the default view property to another value, then change it back to the view you want, that will make sure the metadata is updated. image
  3. now you can add the PCF control.
  4. publish and everything should work fine.

I think there's not much I can do to fix this. I'll add this as a known issue in wiki and keep this issue open so we can monitor when it is resolved by MS.

cc @RainCityAndrew @wenstarner

RainCityAndrew commented 2 months ago

Amazing and nice find for the workaround! I hate using the old editor so this is perfect.

Thank you so much for the beyond amazing work on your components they're one of the best!

wenstarner commented 2 months ago

I agree with @RainCityAndrew, thank you @khoait for all your time and effort! This is so much appreciated :) The workaround is great, and the detail is super interesting to read about!