cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
YDDecs
Level: Powered On

Number sequence between app and D365FO

Hi Experts,

 

I am creating an App which will create new sales order in Dynamics 365FO, and so far with help of community and forums I am progressing well on it. (Still new to the world of PowerApps and Flow).

 

Automatic number sequence is steup in D365 for the SalesOrders entity and I need to tell the app to use it when generating new number, but I am currently stuck on it.

 

Tried using the following formula: F_SalesHeader.Lastsubmit.SalesOrderNumber -> but it doesn't work, Dynamics reads it as empty field.
I have placed this formula in the App, under the Sales order number data card as Default.

 

Is there something wrong I am doing, or is the formula wrong?

 

Any suggestions will be highly appreciated.

 

Thank you!

6 REPLIES 6
Community Support Team
Community Support Team

Re: Number sequence between app and D365FO

Hi @YDDecs ,

Based on the issue that you mentioned, I think you have some misunderstanding on the EditForm1.Lastsubmit formula.

 

The EditForm1.Lastsubmit formula would return the latest record the Edit form1 submitted previously. If the Edit form1 does not submit an record previously or the Edit form has been reset, the EditForm1.Lastsubmit formula would return blank record.

 

As an alternative solution, please consider take a try with the following workaround:

Add a Timer control within your Edit screen, set the Duration property to following:

1000

set the AutoStart property and Repeat property to following:

true

set the OnTimerEnd property to following:

Refresh('SalesOrders Entity')

set the Visible property of the Timer control to following:

false

Set the Default property of the Text Input box within the SalesOrderNumber Data card to following:

Last('SalesOrders Entity').SalesOrderNumber

Please consider take a try with above solution, 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.
YDDecs
Level: Powered On

Re: Number sequence between app and D365FO

Hello @v-xida-msft ,

 

Thanks for the replay, much appreaciated.

 

While setting up the suggested timer and formulas, for :
Refresh('SalesOrders Entity')
Last('SalesOrders Entity').SalesOrderNumber

It is giving me error, as below image:
data1_err.PNGtimer1_err.PNG

 

Here how the datacard of SO looks like:
SO_datacard.PNG

 

I tried changing it to "Sales order_DataCard1" , for the data source, but still the same. 

The timer is placed within "Screen1" , as it is not alowing me to place it in the Edit Form where the SO datacard is.

 

Any ideas?

 

Thank you!

Community Support Team
Community Support Team

Re: Number sequence between app and D365FO

Hi @YDDecs ,

Please put your Timer control within Edit screen rather than within Edit form (outside the Edit form).

 

In addition, please modify your formula as below:

Refresh([@'SalesOrders Entity'])

 

Last([@'SalesOrders Entity']).SalesOrderNumber

Please note that the 'SalesOrders Entity' represents the Entity data source your Edit form connects to. On your side, you should replace it with your own actual Entity data source name.

 

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.
YDDecs
Level: Powered On

Re: Number sequence between app and D365FO

Hi @v-xida-msft ,

 

The timer is outside the Edit Form.

For the Entity , I am using "SalesOrderHeadersV2" which is the Data source of the line "Sales order number". For which i need PowerApps to communicate that it needs to use the number sequence from Dynamics in order to generate the next Sales Order number.

 

I have edited the formula as suggested and I am getting the below error:
error_DAX.PNG

 

It seems that it detects it as empty field - no number being generated, and I was getting the same error in the past. Not sure anymore what the issue might be. I am really lost now.

==========================================================================

Let me describe the whole scenario, maybe you can point out something i did wrong.

 

The App is really simple as concept. It containts 2 Edit Froms in which I have used the Dynamics 365 Fin Ops connector in order to get the 2 tables which i need "SalesOrderHeadersV2" and "SalesOrderLines".

I have selected few fields which I need for the end user to fill in.
Here is how it looks:

App1.PNG

And for the functions I have done the follwoing:
Set the button's OnSelect Property to SubmitForm(F_SalesHeaderV2)
OnSuccess property of that form is set to SubmitForm(F_SalesLines)

 

OnSuccess property of sales lines will reset both forms to allow next SO and Line to be created. So I set it to ResetForm(F_SalesHeader); ResetForm(F_SalesLines)

 

And now I have followed your suggestion with the Timer and implemeted in to the App, as follows:

Add a Timer control within your Edit screen, set the Duration property to following:

2000

set the AutoStart property and Repeat property to following:

true

set the OnTimerEnd property to following:

Refresh([@'SalesOrderHeadersV2'])

set the Visible property of the Timer control to following:

false

Set the Default property of the Text Input box within the SalesOrderNumber Data card to following:

Last(@'SalesOrderHeadersV2').SalesOrderNumber

 

I have inserted the app in Dynamics, and after I run it and populate the fields with relevant data (currently using Contoso for testing purpouses) , it results to the above error and it does not create SO.

 

The thing is that, if i put correct number of SO manually(following the number sequence) - it will generate SO withing Dynamics.
So my assumption is that the problem is comming from  linking/telling the Sales order field in the App to use the numer sequence of Dynamics.

 

Thanks in advance!

Community Support Team
Community Support Team

Re: Number sequence between app and D365FO

Hi @YDDecs ,

Is the "Sales order number" column a Auto-Increment type column in your "SalesOrderHeadersV2" Entity?

 

If the "Sales order number" column is a Auto-Increment type column in your "SalesOrderHeadersV2" Entity, I afraid that there is no way to set a value for this field manually within your app. Because the "Sales order number" column value would be populated by your D365FO system automatically.

 

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.
YDDecs
Level: Powered On

Re: Number sequence between app and D365FO

@v-xida-msft, Yes the field is and it needs to be populated by D365 automatically, I am not looking for manual generate.

 

We posted responce at the same time, if you look at my previouse reposnce I have elaborate on the whole picture. Smiley Happy

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 183 members 4,959 guests
Please welcome our newest community members: