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

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
Super User
Super User

@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
Super User

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
Super User
Super User

@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

@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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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