cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ezi79
Helper I
Helper I

can not generate ref no on save as draft or final submit

@CNT 

Good evenings  

Could you again please help me with my powerapps issue ?.

I got two buttons one for saves as draft and the other one for final submit 

I would like to generate reference no

  • when user clicks on saves as draft or
  • clicks on final submit without first save as draft or
  • clicks on first save as draft and final submit 

At the moment with my formula it only generates ref no when someone first clicks on save as draft and goes back selects the item from gallery and clicks on final submit 

When they click on save as draft only ,Ref no field is empty but all the other data submitted. Similarly when they click on final submit Ref no field is empty but all the other data submitted

 

Formula on Save as draft button On Select:

SubmitForm(Form1);If(Form1.LastSubmit.RefNo=Blank() And DataCardValue8.Selected.Value="A and B ", Patch(FCOG,Form1.LastSubmit,{Status:"Draft", RefNo: Concatenate(Text(DataCardValue11.SelectedDate,"ddmmyyyy"),"-", ddBusinessArea.Selected.Value,"-",Text(Form1.LastSubmit.ID))}), Patch(MyForm,Form1.LastSubmit,{Status:"Draft"}));Navigate(Home,ScreenTransition.Cover)

 

Formula on Final submit   button On Select:

SubmitForm(Form1); If(Form1.LastSubmit.RefNo=Blank() And DataCardValue8.Selected.Value="A and B", Patch(FCOG,Form1.LastSubmit,{Status:"Final", RefNo: Concatenate(Text(DataCardValue11.SelectedDate,"ddmmyyyy"),"-", ddBusinessArea.Selected.Value,"-",Text(Form1.LastSubmit.ID))}), Patch(MyForm,Form1.LastSubmit,{Status:"Final"}));Navigate(Home,ScreenTransition.Cover)

 

Any help would be appreciated 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
CNT
Community Champion
Community Champion

@ezi79 Please update your code like this,

In the OnSelect of the Save as draft button,

UpdateContext({ctxSaveAs:"Draft"});
SubmitForm(Form1)

In the OnSelect of the Final submit button,

UpdateContext({ctxSaveAs:"Final"});
SubmitForm(Form1)

In the OnSuccess of Form1,

If(Form1.LastSubmit.RefNo=Blank() And DataCardValue8.Selected.Value="A and B ", Patch(FCOG,Form1.LastSubmit,{Status:ctxSaveAs, RefNo: Concatenate(Text(DataCardValue11.SelectedDate,"ddmmyyyy"),"-", ddBusinessArea.Selected.Value,"-",Text(Form1.LastSubmit.ID))}), Patch(MyForm,Form1.LastSubmit,{Status:ctxSaveAs}));
Navigate(Home,ScreenTransition.Cover)

 

View solution in original post

6 REPLIES 6
Jcook
Super User III
Super User III

Hello @ezi79 

 

Which data source are you using?


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Hello @Jcook 

I am using Sharepoint list as data source 

thanks 

 

CNT
Community Champion
Community Champion

@ezi79 Please update your code like this,

In the OnSelect of the Save as draft button,

UpdateContext({ctxSaveAs:"Draft"});
SubmitForm(Form1)

In the OnSelect of the Final submit button,

UpdateContext({ctxSaveAs:"Final"});
SubmitForm(Form1)

In the OnSuccess of Form1,

If(Form1.LastSubmit.RefNo=Blank() And DataCardValue8.Selected.Value="A and B ", Patch(FCOG,Form1.LastSubmit,{Status:ctxSaveAs, RefNo: Concatenate(Text(DataCardValue11.SelectedDate,"ddmmyyyy"),"-", ddBusinessArea.Selected.Value,"-",Text(Form1.LastSubmit.ID))}), Patch(MyForm,Form1.LastSubmit,{Status:ctxSaveAs}));
Navigate(Home,ScreenTransition.Cover)

 

View solution in original post

@CNT 

This is great .It is now working thank you so much , have a lovely weekend

CNT
Community Champion
Community Champion

@ezi79 Glad to help!

@CNT 

Hi again 

I am not sure what is going on with this form but it does not generate ref no now on save as draft button and final submit button ,It only generates when someone save as draft first and select the item from the gallery to edit and clicks on final submit 

 Any ideas why it is not working ?, I have not change anything on the code. 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,611)