Hi @Koen5 ,
I've ran into this exact issue as well, with both this journal and other journals. ItemArrivalJournals does not follow a +1 sequence like you say. This is because whenever you post Item Arrivals, through PO's etc, the record is posted as an item arrival journal, but don't show up in the "ItemArrivalJournalHeadersV2" entity. Since this entity is only showing journals specifically posted through Item Arrival. I initially did something like you, and iterated upwards from the last journal in ItemArrivalJournals, but ran into the same issues as you did, where you can end up being so far behind on the ItemArrivalJournalHeadersV2 seq. number. Since you almost never create Item arrivals manually through a journal. At least not compared to other item arrivals.
So for a good solution to this, you have two options:
- Coordinate with a developer to make a custom entity, where you can create item arrival journal without including the item arrival journal number.
- Coordinate with a developer and have them setup an Azure function which writes to ItemArrivalJournals. Then you will be able to post HTTP request to the Azure function which is then posted to the system. For some reason, it's possible to post to this entity through Azure functions without needing the next Journal Batch Number in the sequence, but not from PowerAutomate.
In my opinion this is something that should be possible with PowerAutomate, so I suggest that you post it to the PowerAutomate suggestion page. I'll do the same, and hopefully selecting the next number in the number sequence for all journals will be in a future release.
Hopefully I were able to provide some clarity on the issue.
Br
Joachim