cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mstace
New Member

Create Submit and Add Another button and retain certain data from last submit (also have submit and finish)

Hi All,

 

We've created an app for vehicle permitting that saves to a sharepoint list then sends off for approval etc through flows.

 

Have successfully created clear and submit form buttons, however I would like to have an additional SUBMIT option to submit and add another, which would clear most data cards but keep certain cards from the last submit (ie applicant name number etc)

 

I've done a pretty exhaustive search but can't find anything that allows me to do this from the submit button and still allow me to have a submit and finish, all possibilities are blanket and don't give both possibilities.

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Mstace ,

Please make sure the LastSubmitted variable is populated with proper record value.

 

Please modify the formula within the OnSelect property of the "Additional Button":

Set(IsDuplicate, true);
SubmitForm('FSPL Vehicle Permit (working)');

 

Set the OnSuccess property of the 'FSPL Vehicle Permit (working)' to following:

Set(LastSubmitted, 'FSPL Vehicle Permit (working)'.LastSubmit);
If(
   IsDuplicate = true,
   NewForm('FSPL Vehicle Permit (working)'),
   ResetForm('FSPL Vehicle Permit (working)')
)

 

Set the Default property of the 'Applicants Name' Text Box to following:

If(
   'FSPL Vehicle Permit (working)'.Mode = FormMode.New,
   If(
       IsDuplicate = true && !IsBlank(LastSubmitted),
       LastSubmitted.'Applicants Name',
       Parent.Default
   ),
   Parent.Default
)

Please make sure the LastSubmitted variable is populated with proper record value.

 

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.

View solution in original post

4 REPLIES 4
eka24
Super User III
Super User III

You can create a variable on the Onsuccess property of the form. 

Set(VarLast,FormName.LastSubmit)

 

Then Use the variable in the default of the Textbox example:

VarLast. ID

VarLast.Name

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

v-xida-msft
Community Support
Community Support

Hi @Mstace ,

Do you want to add a new form entry and retain certain data from previous submission when you press the additional submit button?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Add a "Additional Submit" button in your canvas app. Set the OnSelect property to following:

SubmitForm(EditForm1);
NewForm(EditForm1);
Set(IsDuplicate, true)

Set the OnSuccess property of the Edit form to following:

Set(LastSubmitted, EditForm1.LastSubmit)

 

Set the OnSelect property of the "Submit" button (original submit button) to following:

SubmitForm(EditForm1);
Set(IsDuplicate, false);
Back()

 

Within your EditForm1, you could set default value for these certain fields where you want to retain data from previous submission through the LastSubmitted variable. E.G. Set the Default property of the Text Input Box inside the Text field data card to following:

If(
   EditForm1.Mode = FormMode.New,
   If(
      IsDuplicate = true && !IsBlank(LastSubmitted),
      LastSubmitted.TextField1
   ),
   Parent.Default
)

Please consider take a try with above solution, then check if the issue is solved.

 

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.

@v-xida-msft 

 

Yes this is the direction in which i was heading.

 

I've made the changes as per post however it still creates a blank new form on submission for the additional button, the original submit works successfully.

 

The first Data Card is as below

If('FSPL Vehicle Permit (working)'.Mode = FormMode.New,If(IsDuplicate = true && !IsBlank(LastSubmitted),LastSubmitted.'Applicants Name'),Parent.Default)

 

Additional submit is as follows

SubmitForm('FSPL Vehicle Permit (working)');NewForm('FSPL Vehicle Permit (working)');Set(IsDuplicate, true)

 

Hi @Mstace ,

Please make sure the LastSubmitted variable is populated with proper record value.

 

Please modify the formula within the OnSelect property of the "Additional Button":

Set(IsDuplicate, true);
SubmitForm('FSPL Vehicle Permit (working)');

 

Set the OnSuccess property of the 'FSPL Vehicle Permit (working)' to following:

Set(LastSubmitted, 'FSPL Vehicle Permit (working)'.LastSubmit);
If(
   IsDuplicate = true,
   NewForm('FSPL Vehicle Permit (working)'),
   ResetForm('FSPL Vehicle Permit (working)')
)

 

Set the Default property of the 'Applicants Name' Text Box to following:

If(
   'FSPL Vehicle Permit (working)'.Mode = FormMode.New,
   If(
       IsDuplicate = true && !IsBlank(LastSubmitted),
       LastSubmitted.'Applicants Name',
       Parent.Default
   ),
   Parent.Default
)

Please make sure the LastSubmitted variable is populated with proper record value.

 

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.

View solution in original post

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,175)