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

LastSubmit some fields not the last submitted

OnSuccess of a .new form has the following:

Patch(colPunchListK2SD2021, Defaults(PunchListK2SD2021), FormNew.LastSubmit);
Set(varVisible,false);
ResetForm(FormNew);
Notify("Created!", NotificationType.Success, 2000);
Navigate(ScreenBrowse);

 

However, in the GalleryBrowse that picks up the colPunchListK2SD2021, the record shows previous values and not a blank value from the last submitted new record. Not sure if I misunderstand how LastSubmit works. Any thoughts here?

1 ACCEPTED SOLUTION

Accepted Solutions

Noticed it seems to update my ID 1 item instead of adding a new item. Maybe this is a patch problem?

Now I changed my Defaults() to use the collection instead of the datasource I'm pulling from. Seems to work. Guess you can't patch a new record with another datasource's defaults?

Patch(colPunchListK2SD2021, Defaults(colPunchListK2SD2021), FormNew.LastSubmit);
Set(varVisible,false);
ResetForm(FormNew);
Notify("Created!", NotificationType.Success, 2000);
Navigate(ScreenBrowse);

View solution in original post

6 REPLIES 6
HimanshuSSharma
Resolver I
Resolver I

@catpigeon do you want to add a blank record to the colPunchListK2SD2021? or do you want to add the last submitted values to the colPunchListK2SD2021?

Last Submit will add the last set of values added in the Form. You could also recreate colPunchListK2SD2021 to get the same result.

Want to add the last submitted form. It seems to add the last value from a few submissions ago if I leave a particular field blank. If I've left the field blank on the newly submitted form I don't want to patch a last submitted from a few days ago.

Is it possible that you have some default value that is getting populated?

Your assumption and usage seem to be correct, the other way you can do this is by creating colPunchListK2SD2021 again on Success using ClearCollect or Set functions.

No defaults for those particular fields. Just using clearcollect at app start and trying to get away from reloading database every time. Tried set variable then a patch the variable and the same result of patching last non blank data in a field from a few submissions ago. This is the OnSuccess of the FormNew:

Set(varNewLastSubmitted, FormNew.LastSubmit);
Patch(colPunchListK2SD2021, Defaults(PunchListK2SD2021), varNewLastSubmitted);
Set(varVisible,false);
ResetForm(FormNew);
Notify("Created!", NotificationType.Success, 2000);
Navigate(ScreenBrowse);

 

The LastSubmit logic seems to be per field per user and not per record. If I submit something new with some blank values it patches values from days ago in that field. 

Noticed it seems to update my ID 1 item instead of adding a new item. Maybe this is a patch problem?

Now I changed my Defaults() to use the collection instead of the datasource I'm pulling from. Seems to work. Guess you can't patch a new record with another datasource's defaults?

Patch(colPunchListK2SD2021, Defaults(colPunchListK2SD2021), FormNew.LastSubmit);
Set(varVisible,false);
ResetForm(FormNew);
Notify("Created!", NotificationType.Success, 2000);
Navigate(ScreenBrowse);

View solution in original post

You got that right! Defaults(PunchListK2SD2021) was giving an older record, and patching only the updated fields due to which the blank fields were coming from older values. Like I said your idea was correct, just the defaults() was wrong 🙂

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (100,407)