cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jzcase
Level: Powered On

UPDATED: When I delete the last item in a gallery, it permanently corrupts the form on the same screen (CDS Connector)

OK so I'm almost done building my first app using the CDS connector instead of the Dynamics 365 connector. But I may need to go back if this issue is not fixable.

 

It's a relatively simple app, just one screen with a Form that creates new records using the CDS connector. The cards are all custom and they have a bunch of fancy stuff going on in the "default" "visible" and "required" parameters--but they work beautifully for about a day of testing.

 

After a while, the form spontaneously breaks. See below.

brokenapp.png

 

The form won't submit, and it incorrectly reports that the "Notes" field is required and must contain an integer. It's not just one card, though. Most or all of the cards seem to be mismatched with the field that they update. But this is not visible in Studio. Studio reports no errors and all of the cards appear configured normally.

 

I can "fix" the problem (temporarily) by duplicating the Screen EDIT1: cutting and pasting the form. Then it works again for a while. Here's an example:

whenappworks.gif

EDIT2: I can reproduce the breakage! It works fine until a user deletes the last item in the gallery. Once I do that, the form breaks until I Cut+Paste it again in Studio.

  • The breakage is not related to whether there are any items in the gallery, just whether the user has deleted the last one. E.g., if it's broken and I manually add items through CDS, it doesn't fix it.
  • So something about the Delete button causes the form to break permanently. Here's the Delete button code:
Remove([@'Work Logs'],ThisItem);
ClearCollect(workLogs,Filter([@'Work Logs'],Owner=currentOwner,'Service Type'='Service Types'.IST,Not('Work Setting'='Work Settings'.'Multiple Students - Participant')));
  • Maybe it has something to do with doing a CearCollect from the Form's data source in CDS that returns 0 results? Somehow this breaks the form?

EDIT3: I have a temporary workaround! On the delete button in the gallery, I set its DisplayMode to:

If(CountRows(workLogs)=1,Disabled,Edit)

So now my users will not be allowed to delete the last entry. Kinda jank, but it works.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: UPDATED: When I delete the last item in a gallery, it permanently corrupts the form on the same screen (CDS Connector)

Hi @jzcase .

Do you mean that if user delete the last record, the form will not display as normal?

The reason why you met this problem is the form's DisplayMode.

The edit form's mode is edit by default.

When its mode is edit , you need to set the form's Item to one spefic item. Or else, it will display "No item to display".

Usually , we set like this if we want to edit an exsiting record.

In your test, you want to create a new record.

In this situation, you need to set the form's Displaymode to New.

In this way, you do not need to set the form's Item.

However, please note that if the new form is submitted, the form's Displaymode will change to Edit automatically.

If you do not set the form's Item, the form will display "No item to display".

So, I suggest you set the Save button to :

 Submit(Form1);NewForm(Form1)

In this way, you could avoid your form's mode changing to Edit.

Here's a doc about form's mode for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-form-detail

 

What's more, since your problem has been solved, if you do not have any other problem, please change your issue's status to "Answered".

Thanks!

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Community Support Team
Community Support Team

Re: UPDATED: When I delete the last item in a gallery, it permanently corrupts the form on the same screen (CDS Connector)

Hi @jzcase .

Do you mean that if user delete the last record, the form will not display as normal?

The reason why you met this problem is the form's DisplayMode.

The edit form's mode is edit by default.

When its mode is edit , you need to set the form's Item to one spefic item. Or else, it will display "No item to display".

Usually , we set like this if we want to edit an exsiting record.

In your test, you want to create a new record.

In this situation, you need to set the form's Displaymode to New.

In this way, you do not need to set the form's Item.

However, please note that if the new form is submitted, the form's Displaymode will change to Edit automatically.

If you do not set the form's Item, the form will display "No item to display".

So, I suggest you set the Save button to :

 Submit(Form1);NewForm(Form1)

In this way, you could avoid your form's mode changing to Edit.

Here's a doc about form's mode for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-form-detail

 

What's more, since your problem has been solved, if you do not have any other problem, please change your issue's status to "Answered".

Thanks!

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jzcase
Level: Powered On

Re: UPDATED: When I delete the last item in a gallery, it permanently corrupts the form on the same screen (CDS Connector)

Thank you! This looks good but I haven't tested it yet. I will test it and mark as a solution if it works.

 

EDIT: It worked! I did have to cut-and-paste the Form one more time, but after that it did the trick and I get no more corruptions.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 50 members 4,853 guests
Please welcome our newest community members: