cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Date works in preview but not in published app

Hello everyone,

 

I am having an issue with a published app, I have deleted and rebuilt the section responsible including deleting and adding the column back into SharePoint.

 

I've never had this issue before but basically in preview mode a date field within a form works fine and gets saved, within the published version however nothing, it just saves everything else in the form except for this one field. I haven't tried all of the fields though tbh.

 

Anything out there? I have found similar issues on this forum but they all seem far too old to be relevant anymore.

 

Thanks in advance,

 

Matt

5 REPLIES 5
Community Support
Community Support

Hi @Blytheee ,

Could you please share a bit more about your issue within your app?

Do you mean that the date field value could not be saved back to your SP List in your published app?

 

Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned.

Please consider remove the Edit form from your canvas app, then re-add a new Edit form, then bind this new added Edit form to your SP List data source, then enable desired fields data cards in this Edit form. Set the Item property of this new Edit form to following:

BrowseGallery1.Selected   // bind it to selected item in your Gallery

modify the reference of your previous Edit form in your app with this new Edit form. Then re-publish your app, check if the issue is solved.

 

If the issue still exists, as an alternative solution, I think the Patch function could achieve your needs. Please set the OnSelect property of the "Submit" button to following:

If(
   EditForm1.Mode = FormMode.New, // EditForm1 represents the Edit form in your app, please replace it with actual form name in your app
   Patch(
         'Your SP List',
         Defaults('Your SP List'),
         EditForm1.Updates
   ),
   Patch(
         'Your SP List',
         BrowseGallery1.Selected,
         EditForm1.Updates
   ) 
);
ResetForm(EditForm1)

Patch function

 

Best regards,

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

Hi @v-xida-msft ,

Thanks for your reply. I am reluctant to go ahead and remove the form due to the fact that all of the visibility and locations of the cards are coded so it means going through and amending around 45 datacards again plus all of the custom drop downs, combo boxes and fields I have added, it does work with a new form that I added as a test so it is just this form but I would like not to have to spend another few hours going through all of the fields again. Plus all the other references to the edit form that will then break.

 

I have deleted and added the fields in SharePoint, and also deleted the datacard and added it back in.

 

Update: I have added Patch instead of SubmitForm and it works for everything except this date field.

 

Thanks,

 

Matt

HI @Blytheee ,

Currently, I could not reproduce your issue on my side. If you just want to save new record and edit existing records in your SP list, you do not need to make any changes to your Edit form, I think the Patch function I provided above could achieve your needs.

 

For the formula I provided above, it would check if the current Edit form is in New mode or Edit Mode. If the Edit form is New mode, execute the Patch function to add new record back to your SP List with your Form data, if the Edit form is Edit mode, execute the Patch function to update the existing record in your SP list with your Form data.

Note: It's no need to add a collection to do a ForAll formula.

 

You could consider submit an assisted support ticket to get further help through the following link:

https://powerapps.microsoft.com/en-us/support/pro

 

Best regards,

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

Thanks @v-xida-msft,

 

No luck with anything, Patch will not work with the date still, thanks for the code, it's much simpler than any Patch code I have seen before and works well but just doesn't solve this issue.

 

I will open a ticket, it will be hours of recoding the form to build it again which I want to avoid.

 

It now doesn't work in Preview either.

 

Matt

Hi @v-xida-msft,

I found that the code below worked but only once, you have to go out and back into the screen for it to work again, this is due to the ETAG mismatch. I tried to overcome it with refresh's but this doesn't seem to work. The DatVar is set to the default on ScreenVisible so that if it isn't changed it will patch the current one.


Set(DateVar, DataCardValue157.SelectedDate);
Refresh('Core Cases');
Patch( 'Core Cases', DataTable5.Selected, { 'Placement Required By': DateVar } );
SubmitForm(Form2);
Refresh('Core Cases');

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (22,405)