Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

D365FO Generating number sequence

Hello guys,


My data source for my Powerapp is D365FO. My goal is to allow users to create purchase requisitions via powerapps (but this can be valid for purchase orders, expense reports...etc). I created a gallery which displays current purchase requisitions, I can update them - that works fine.

The issue is when I want to create a new purchase requisitions. The issue is that D365FO requires a number sequence number for the purchase requisitions. However:

1) When I do not enter the purchase requisition number, D365 says "invalid..." it simply wants the purchase requisition number.

2) When I enter the proper purchase requisition number, which is e.g. 000023 (current purchase requisition number is 000022), then it says I am not able to assign this number, because D365 needs to generate its own number...

3) I thought I would set the number sequence to manual, but funny thing, I cannot find the number sequence setup. 


My question is how to deal with this? Is there a function which will fetch the next number to powerapps and then uses it to create the record in D365FO?


Thank you,


Super User
Super User

Hi @PowerLukas 


I don't know D365FO at all, but I assume this might be due to the fact that you're not allowed to set custom primary  / foreign keys yourself. E.g. your purchase requisition number needs to be generated by the system, not by you.


I assume it is the same/similar in D365FO as it is in SharePoint. If you'd like to create a new record, you'd need to use Defaults('<source>')


Since your source is D365FO, perhaps you could try to use Defaults(D365FO) for the purchase requisition number. That might solve your problem.


I hope this helps.


Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.


I am not sure what you mean by your suggest solution. I can imagine it is a difficult scenario, because in D365FO, you must click "New" and then the system assigns you a number from the number sequence. However in PowerApps, if you click "New", D365FO does not yet know you clicked New, so how could it give you a number sequence number..

Maybe PowerApps are not meant for creating such records.



New Member

hi guy, do you solve the problem ?i met the same issue,

Sorry for my late answer. Unfortunately not. The answer will be Dual Write I think. Try looking into that. There are some videos on youtube about that. 

Helpful resources

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!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.


Demo Extravaganza is Back!

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

Top Solution Authors
Top Kudoed Authors
Users online (50,492)